deprecate old projects & reduce CI workload
This commit is contained in:
7
projects/_deprecated/leet-code/src/leet_code/Main.hx
Normal file
7
projects/_deprecated/leet-code/src/leet_code/Main.hx
Normal file
@@ -0,0 +1,7 @@
|
||||
package leet_code;
|
||||
|
||||
import kiss.Kiss;
|
||||
import kiss.Prelude;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class Main {}
|
||||
14
projects/_deprecated/leet-code/src/leet_code/Main.kiss
Normal file
14
projects/_deprecated/leet-code/src/leet_code/Main.kiss
Normal file
@@ -0,0 +1,14 @@
|
||||
// solution to: https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/
|
||||
(function :Array<Int> twosum [:Array<Int> numbers target]
|
||||
(let [di (new Map<Int,Int>)]
|
||||
(doFor [i num] (enumerate numbers 1)
|
||||
// (print "$i $num")
|
||||
(if (di.exists (- target num))
|
||||
(return [(dictGet di (- target num)) i]))
|
||||
(dictSet di num i)))
|
||||
(return null))
|
||||
|
||||
(assert (= (.toString [2 3]) (.toString (twosum [1 2 3 4 5 6] 5))))
|
||||
(assert (= (.toString [1 2]) (.toString (twosum [2 7 11 15] 9))))
|
||||
(assert (= (.toString [1 3]) (.toString (twosum [2 3 4] 6))))
|
||||
(assert (= (.toString [1 2]) (.toString (twosum [-1 0] -1))))
|
||||
Reference in New Issue
Block a user