Skip to content

Commit 66c05e4

Browse files
authored
Merge pull request #1756 from Lustellz/main
[Lustellz] WEEK 02 problems
2 parents 15fffb6 + 92a3fc2 commit 66c05e4

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

climbing-stairs/Lustellz.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// week2 goal
2+
// not knowing how to express, I googled and referenced a bit
3+
function climbStairs(n: number): number {
4+
let stairArray: number[] = [1,2]
5+
for(let i = 2;i<n; i++){
6+
stairArray.push(stairArray[i-1]+stairArray[i-2])
7+
}
8+
return stairArray[n-1]
9+
};

top-k-frequent-elements/Lustellz.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// frequency is k times

valid-anagram/Lustellz.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// week 2's goal
2+
// only focusing on not using for... not a good approach :(
3+
4+
function isAnagram(s: string, t: string): boolean {
5+
if(s.length !== t.length) return false
6+
let sArray : string[] = s.split('').sort()
7+
s = sArray.join('')
8+
let tArray : string[] = t.split('').sort()
9+
t = tArray.join('')
10+
if(s === t) return true
11+
else return false
12+
};
13+
14+
// reflection: not to be hurry & have more time for pondering

0 commit comments

Comments
 (0)