0
How to check two integer has the same digit but in different position
Let say: Number 1 : 7866 Number from user: 6876 This is consider "same" even tho different position. How can i solve this issue?
1 Respuesta
+ 3
Convert both to strings and sort those 2 . Now if both are equal then they are considered same else no.
ex:
7899, 9879
Strings "7895", "9875"
Sort : "5789", "5789" both are equal hence same..
or find permutations on one number, comapare each to the required number. if match stop.
hope it helps...