LUCKYNO - Editorial

LUCKYNO Editorial.

Problem Link:- LUCKYNO

Problem Setter: @anon13218864
Editorialist: @arpitgupta16

Prerequisites: sorting, basic operators

Explantion: Here we have to store the integers in the given number
and sort the array. Now triverse the array and check
if differnce of any two number is not 2 then print NO else YES
Example: 13954
arr = {1, 3, 9, 5, 4}
after sorting arr = {1, 3, 4, 5, 9}
|3-4| != 2, Hence output is NO

Setter’s and Editorialist’s Solution:

Setters and Editorialists Solutions.

Solution Link.

Hope you liked it and feel free to share any approach or ask any doubts in comments below. Other optimal solutions are encouraged too.