This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| fun isLowerAlphaNum( ch1: Char): Boolean { | |
| return (ch1 >= 'a' && ch1 <= 'z') || (ch1 >= '0' && ch1 <= '9') | |
| } | |
| fun isPalindrome(s: String): Boolean { | |
| if (s.count() < 2) return true | |
| val input = s.toLowerCase() | |
| var i = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| fun hasCycle(head: ListNode?): Boolean { | |
| var first: ListNode? = head | |
| var second: ListNode? = head | |
| while(first != null && first.next != null) { | |
| first = first?.next?.next | |
| second = second?.next | |
| if(first == second) return true | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun twoSum(nums: IntArray, target: Int): IntArray { | |
| val rests = hashMapOf<Int, Int>() | |
| for ((i, v) in nums.withIndex()) { | |
| val rest = target - v | |
| if (rests.containsKey(rest)) { | |
| return intArrayOf(i, rests[rest]!!) | |
| } | |
| rests[v] = i | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- Actions --- | |
| $Copy <M-C> | |
| $Cut <M-X> <S-Del> | |
| $Delete <Del> <BS> <M-BS> | |
| $LRU | |
| $Paste <M-V> | |
| $Redo <M-S-Z> <A-S-BS> | |
| $SearchWeb <A-S-G> | |
| $SelectAll <M-A> | |
| $Undo <M-Z> |