23 lines
524 B
Markdown
23 lines
524 B
Markdown
---
|
|
parents:
|
|
- "[[Вопросы для собеседование Java]]"
|
|
---
|
|
```java
|
|
public static String test(String s) {
|
|
if (s.length() == 1) {
|
|
return "YES";
|
|
} else {
|
|
if (s.substring(0, 1).equals(s.substring(s.length() - 1, s.length()))) {
|
|
if (s.length() == 2) {
|
|
return "YES";
|
|
}
|
|
return test(s.substring(1, s.length() - 1));
|
|
} else {
|
|
return "NO";
|
|
}
|
|
}
|
|
}
|
|
|
|
```
|
|
|
|
*** |