Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sik9252/MajorityElement.js
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간값이 해당 값이라는 것을 어떻게 생각해 내는지 신기하고 부럽습니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 스킬(?)은 양치기 영향이 있는듯 합니다. 예전에 백준에서 풀어본 기억이...ㅎ 처음 보는거였으면 전혀 몰랐을듯요

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @param {number[]} nums
* @return {number}
*/
var majorityElement = function (nums) {
nums.sort((a, b) => a - b);
return nums[Math.floor(nums.length / 2)];
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이렇게도 풀 수 있네요 👍 신박하다

13 changes: 13 additions & 0 deletions sik9252/ReverseLinkedList.js
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 너무 헷갈리던데 쉽게 잘 푸셨네요!

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var reverseList = function (head) {
let temp = null;
let curr = head;

while (curr !== null) {
const next = curr.next;
curr.next = temp;
temp = curr;
curr = next;
}

return temp;
};