Given two integers x1 and x2, return true if the numbers written with no leading zeros contain the same digits. That is, the string representation of one number is a permutation of the string representation of the other.
x1 = 1234; x2 = 4321; tf = same_digits(x1,x2)
tf = true
x1 = 1234; x2 = 1244; tf = same_digits(x1,x2)
tf = false
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry PiLearn more
Opportunities for recent engineering grads.Apply Today
New to MATLAB?Learn MATLAB today!
Play games and win prizes!Learn more