SWIFT solution


  • 0
    B

    I'm new to leetcode and I'm not sure how the OJ system works.
    Here's my swift solution:

    class Solution {
        func isNumber(_ s: String) -> Bool {
            if Int(s) != nil || Double(s) != nil
            {
                return true
            }
            else {
                return false
            }
            
        }
    }
    

    It works in latest xcode playground but shows me some error in the OJ system. I guess leetcode has some sorts of hidden code after you put your code in it.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.