For another convoluted impl you could do some kind of string format print into a string. Then do your if/else comparing that string containing the last digit. Maybe create a hash set collection of all single digit even strings, then you’ve got O(1) performance using a contains() method.
You only need to do the comparison on the last digit.
couldn’t you just check the numbers in binary for the ones place
Yeah that should be last bit, not last digit lol.
For another convoluted impl you could do some kind of string format print into a string. Then do your if/else comparing that string containing the last digit. Maybe create a hash set collection of all single digit even strings, then you’ve got O(1) performance using a contains() method.