Strobogrammatic Number


#1

A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).

Examples:

Input:  "69"
Output: true

Input:  "962"
Output: false

#2

This is a ridiculous question, but here is a solution that beats 100% of the OJ.

class Solution {
    public boolean isStrobogrammatic(String num) {
        Set<String> set = new HashSet<>(Arrays.asList("00","11", "69", "96", "88", "696"));
        for(int i=0, j = num.length()-1;i<=j;i++, j--){
            if(!set.contains(num.charAt(i)+""+num.charAt(j))) return false;
        }
        return true;
    }
}