15 java substring - String | Java | Hackerrank

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

good explanation, check out the audio it's nearly not proper

sowmyasg
Автор

why and how you do not care about constrains ?

mohamedessam
Автор

public static String getSmallestAndLargest(String s, int k) {
String smallest = s.substring(0, k);
String largest = s.substring(0, k);

for (int i = 0; i <= s.length() - k; i++) {
String cuttedString = s.substring(i, k + i);

if < 0)
smallest = cuttedString;

if > 0)
largest = cuttedString;
}

return smallest + "\n" + largest;
}

nitheshkumark
welcome to shbcf.ru