-
Notifications
You must be signed in to change notification settings - Fork 25
feat: adds amiyah jones' lesson 12 & stack typescript files #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 71 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
8cc92d0
Create README.md
AmiyahJo 50b1861
Delete lesson_00/amiyahjones/README.md
AmiyahJo 27d57c0
Merge branch 'code-differently:main' into main
AmiyahJo fa3c700
Merge branch 'code-differently:main' into main
AmiyahJo 7c2d053
Merge branch 'code-differently:main' into main
AmiyahJo faedd1b
Merge branch 'code-differently:main' into main
AmiyahJo 19a4187
Merge branch 'code-differently:main' into main
AmiyahJo 7711266
Merge branch 'code-differently:main' into main
AmiyahJo 9a10c4c
Merge branch 'code-differently:main' into main
AmiyahJo 3ea50c4
Merge branch 'code-differently:main' into main
AmiyahJo d7b772d
Merge branch 'code-differently:main' into main
AmiyahJo de46b67
Merge branch 'code-differently:main' into main
AmiyahJo b891561
Merge branch 'code-differently:main' into main
AmiyahJo 7c9f2db
Merge branch 'code-differently:main' into main
AmiyahJo ff3ba35
Merge branch 'code-differently:main' into main
AmiyahJo 457feea
Merge branch 'code-differently:main' into main
AmiyahJo 5868f9d
Merge branch 'code-differently:main' into main
AmiyahJo 28eacd4
Merge branch 'code-differently:main' into main
AmiyahJo bca4933
Merge branch 'code-differently:main' into main
AmiyahJo 9ff0f9e
Merge branch 'code-differently:main' into main
AmiyahJo 8d02849
Merge branch 'code-differently:main' into main
AmiyahJo 6dd3a43
Merge branch 'code-differently:main' into main
AmiyahJo 95f56a5
Merge branch 'code-differently:main' into main
AmiyahJo 0f4dbac
Merge branch 'code-differently:main' into main
AmiyahJo a3b9984
Merge branch 'code-differently:main' into main
AmiyahJo 54cd199
Merge branch 'code-differently:main' into main
AmiyahJo edbe7c0
Merge branch 'code-differently:main' into main
AmiyahJo 7f0a084
Merge branch 'code-differently:main' into main
AmiyahJo a905b74
Merge branch 'code-differently:main' into main
AmiyahJo 2d69531
Merge branch 'code-differently:main' into main
AmiyahJo df48fbd
Merge branch 'code-differently:main' into main
AmiyahJo c972d14
Merge branch 'code-differently:main' into main
AmiyahJo bc3907c
Merge branch 'code-differently:main' into main
AmiyahJo c3eabbb
Merge branch 'code-differently:main' into main
AmiyahJo 9fff7d0
Merge branch 'code-differently:main' into main
AmiyahJo 4c57926
Merge branch 'code-differently:main' into main
AmiyahJo 8dd5d42
Merge branch 'code-differently:main' into main
AmiyahJo 18f65ee
Merge branch 'code-differently:main' into main
AmiyahJo 2dd1645
Merge branch 'code-differently:main' into main
AmiyahJo 0de8601
Merge branch 'code-differently:main' into main
AmiyahJo 85dd364
Merge branch 'code-differently:main' into main
AmiyahJo 0afda26
Merge branch 'code-differently:main' into main
AmiyahJo f31e8d9
Merge branch 'code-differently:main' into main
AmiyahJo 3e24069
Merge branch 'code-differently:main' into main
AmiyahJo 8600f6c
Merge branch 'code-differently:main' into main
AmiyahJo 563b076
Merge branch 'code-differently:main' into main
AmiyahJo b01a324
Merge branch 'code-differently:main' into main
AmiyahJo 697a72d
Merge branch 'code-differently:main' into main
AmiyahJo 92891f6
Merge branch 'code-differently:main' into main
AmiyahJo 17fdee5
Merge branch 'code-differently:main' into main
AmiyahJo 90a4c55
feat: adds lesson12.ts snippets
07989fb
Merge branch 'code-differently:main' into feature/lesson12_extra
AmiyahJo b0c63c4
feat: adds listnode
2be3bd2
feat: typescript versoin of creating a ListNode
39db8a2
chore: adjust listnode comment
4a4e6fa
feat: adjusts .java code to typescript language
14d00d6
fix: joined lesson12.ts oddPoints and evenPoints together
e566771
fix: commented out lesson12.ts while loop
d598b70
feat: adds while loop using my current pointer
992be27
feat: adds java implementation for reference
4f9e138
feat: adds typescript version of code for stack.ts
7ca9a49
vhore: remove .java implementation comments of stack.ts
394abcf
fix: final adjustments with peek() return undefined to null
47f79a3
chore: remove lesson12.ts comments
3e66149
fix: used singlequotes for lesson12.ts strings
d9eaced
fix: removed 'this.top!' for githubs non-null assertion
d511f07
fix: adjustments to this.top.val and boolean in stack.ts
d6af86e
fix: alter this.top in stack.ts
295e936
fix: alter this.top text
6175f1b
fix: peek() method in stack.ts
9937d62
fix: peek() method in stack.ts if statement
c69fb10
Merge branch 'code-differently:main' into feature/lesson12_extra
AmiyahJo f692d0a
Merge branch 'code-differently:main' into feature/lesson12_extra
AmiyahJo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
import { ListNode } from './list_node.js'; | ||
|
||
export class Lesson12 { | ||
/** | ||
* Provide the solution to LeetCode 3062 here: | ||
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game | ||
*/ | ||
|
||
public gameResult(head: ListNode | null): string { | ||
return ''; | ||
let [oddPoints, evenPoints] = [0,0]; | ||
let current = head; | ||
|
||
while (current != null && current.next != null) { | ||
if (current.val > current.next.val) { | ||
evenPoints++; | ||
} else if (current.val < current.next.val) { | ||
oddPoints++; | ||
} | ||
current = current.next ? current.next.next || null : null; | ||
} | ||
|
||
if (oddPoints > evenPoints) { | ||
return 'Odd'; | ||
} else if (evenPoints > oddPoints) { | ||
return 'Even'; | ||
} else { | ||
return 'Tie'; | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.