Skip to content

Commit 4e258f5

Browse files
committed
fix: change to ts
1 parent 52110ff commit 4e258f5

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed
File renamed without changes.
File renamed without changes.

โ€Žlongest-consecutive-sequence/HerrineKim.jsโ€Ž renamed to โ€Žlongest-consecutive-sequence/HerrineKim.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
var longestConsecutive = function (nums) {
88
// Set์„ ์‚ฌ์šฉํ•ด ์ค‘๋ณต ์ œ๊ฑฐ
9-
const numSet = new Set(nums);
9+
const numSet: Set<number> = new Set(nums);
1010
let longestStreak = 0;
1111

1212
// ๊ฐ ์ˆซ์ž๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์—ฐ์† ์‹œํ€€์Šค๋ฅผ ํƒ์ƒ‰

โ€Žtop-k-frequent-elements/HerrineKim.jsโ€Ž renamed to โ€Žtop-k-frequent-elements/HerrineKim.tsโ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
*/
88
var topKFrequent = function (nums, k) {
99
// ๋นˆ๋„ ๊ณ„์‚ฐ
10-
const frequencyMap = new Map();
10+
const frequencyMap: Map<number, number> = new Map();
1111
for (let num of nums) {
1212
frequencyMap.set(num, (frequencyMap.get(num) || 0) + 1);
1313
}
1414

1515
// ๋ฒ„ํ‚ท ์ •๋ ฌ
16-
const bucket = Array(nums.length + 1).fill(null).map(() => []);
16+
const bucket: number[][] = Array(nums.length + 1)
17+
.fill(null)
18+
.map(() => []);
1719
for (let [num, freq] of frequencyMap) {
1820
bucket[freq].push(num);
1921
}
2022

2123
// ๋นˆ๋„ ๋†’์€ ์š”์†Œ๋“ค ์ถ”์ถœ
22-
const result = [];
24+
const result: number[] = [];
2325
for (let i = bucket.length - 1; i >= 0 && result.length < k; i--) {
2426
if (bucket[i].length > 0) {
2527
result.push(...bucket[i]);

โ€Žvalid-palindrome/HerrineKim.jsโ€Ž renamed to โ€Žvalid-palindrome/HerrineKim.tsโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ var isPalindrome = function (s) {
99
const cleanString = s.toLowerCase().replace(/[^a-z0-9]/g, "");
1010

1111
// ์–‘ ๋์—์„œ ํฌ์ธํ„ฐ๋ฅผ ์ด๋™ํ•˜๋ฉฐ ํ™•์ธ
12-
let left = 0, right = cleanString.length - 1;
12+
let left = 0,
13+
right = cleanString.length - 1;
1314

1415
while (left < right) {
1516
if (cleanString[left] !== cleanString[right]) {

0 commit comments

Comments
ย (0)