-
Notifications
You must be signed in to change notification settings - Fork 86
Add lexicographic comparison task for 2 strings #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Спасибо, что добавил новый вопрос.
Посмотри плз комменты. Есть небольшие замечания по коду и опечатки в тексте.
Coding/README.md
Outdated
return true; | ||
} else { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно не использовать if/else
и вернуть сразу return l1.join('') === l2.join('');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил
Coding/README.md
Outdated
const l1 = s1.split("").sort(); | ||
const l2 = s2.split("").sort(); | ||
|
||
if (l1.join() === l2.join()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот момент тоже поправил
Coding/README.md
Outdated
console.log(check("dog", "dfo")); | ||
console.log(check("doog", "ddog")); | ||
~~~~ | ||
Ответ: для решения задачи нужно разбить дву строки посимвольно, используя метод split, и, полученный массивы отсортировать по возрастанию с использованием стандартного метода sort. Псоле чего к полученным массивам, которые отсортированы лексикографически, применить метод join, который из последних создаст строки и спавнивать уже эти строки. Результат сравнения возвращать из функции. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ответ: для решения задачи нужно разбить дву строки посимвольно, используя метод split, и, полученный массивы отсортировать по возрастанию с использованием стандартного метода sort. Псоле чего к полученным массивам, которые отсортированы лексикографически, применить метод join, который из последних создаст строки и спавнивать уже эти строки. Результат сравнения возвращать из функции. | |
Ответ: для решения задачи нужно разбить две строки посимвольно, используя метод split, и полученные массивы отсортировать по возрастанию с использованием стандартного метода sort. После этого к отсортированным массивам применить метод join, который создаст из них строки, и сравнить эти строки. Результат сравнения вернуть из функции. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В тексте убрал лишние помарки и орфографические ошибки
…но (без добавления запятых).
Добавил задачу с решением для секции Coding
Написать функцию, которая принимает 2 строки и возвращает результат их лексикографического сравнения.