MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

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.

For example

x1 = 1234; x2 = 4321; tf = same_digits(x1,x2)

would output

tf = true

whereas

x1 = 1234; x2 = 1244; tf = same_digits(x1,x2)

would output

tf = false

80 correct solutions
66 incorrect solutions

Last solution submitted on Jun 19, 2015

1 Comment