Okay, so today I decided to tackle this “2316 number” thing. I wasn’t really sure what it was, just saw it floating around online. So, like any good problem-solver, I started with a good old search.
First thing I did was try to figure out, like, what even is a 2316 number? Turns out, It’s a problem to check if the numbers 2,3,1,6 are all appear in a number. Seemed simple enough.
Breaking It Down
I figured the easiest way to check the number is to convert the number to string.

- Convert to String: I just use string convert function.
- Check Contains: use string build in function check if number contain the “2”, “3”, “1”, “6”.
- Then Return: if all true, return true. Otherwise, return false.
I ran a bunch of test cases, like 123, 456, and 2316 itself (of course!). Seems works for every test cases.
I’m pretty happy with how it turned out! It was a fun little challenge to start the day, and it’s always satisfying to see those test cases pass. Plus, it’s always good to brush up on the basics, right?