๐Ÿ“‚
LeetCode Note
  • Introduction
  • Tools
    • Clean Code
    • ่‹ฑๆ–‡ๅฐ่พญๅ…ธ
    • JS Reference
    • ๅธธ่ฆ‹ Edge Case
    • Array Method
    • Object Method
    • Function
    • Hashing
    • Prototype
    • ่™•็† Array ๅฐๆ’‡ๆญฅ
    • String Method
    • Math / Date
    • loop
    • JSON.xx / localStorage
    • Date
    • Regex
    • Memorization
    • reduce condition
    • ๅ‘ฝๅ
  • ็ญ†่จ˜ Note
    • Promise
    • Walking the DOM
    • Element size and scrolling
    • CSS
  • Leetcode todo
    • ToDo
  • Array
    • # Select random poker without duplicates
    • # ๆœ€ๅฐ‘ๆ›ฟๆ›้”ๆˆไธ้€ฃ็บŒๅญ—ไธฒ
    • # 724 Find Pivot Index
    • # 747. Largest Number At Least Twice of Others
    • # 01 getMaxProfit
    • # maxOfBiggestVal
    • # findSecondLargest
    • # 41 First Missing Positive
    • # 134 Gas Station (ๆœ‰ๅœ–)
    • # 202 Happy Number
    • # 344 Reverse String
    • # 412 Fizz Buzz
    • # 561 Array Partition I
    • # 804 Unique Morse Code Words
    • # 905 Sort Array By Parity
    • # 121. Best Time to Buy and Sell Stock.js
    • # 122 Best Time to Buy and Sell Stock II
    • # 189 Rotate Array
    • # 229 Majority Element II
    • # 268 Missing Number.
    • # 299 Bulls and Cows (ๆœ‰ๅœ–)
    • # 896 Monotonic Array
    • # 1002 Find Common Characters
    • # 1051 Height Checker
    • # 1185 Day of the Week
    • # 169 Majority Element
    • # 605. Can Place Flowers
    • # 350 Intersection of Two Arrays II (ๆœ‰ๅœ–)
    • # 482. License Key Formatting
  • Set / Map
    • # GetLengthOfLongestSubstring
    • #1 Two Sum
    • # 217 Contains Duplicate
    • # 1122 Relative Sort Array
    • # 1160 Find Words That Can Be Formed by Characters
    • #811 Subdomain Visit Count
    • # 349 Intersection of Two Arrays
    • # 819 Most Common Word
  • Two Pointer
    • #704. Binary Search
    • #26 Remove Duplicates from Sorted Array (ๆœ‰ๅœ–)
    • #27 Remove Element
    • # 66 Plus One
    • # 80 Remove Duplicates from Sorted Array II (ๆœ‰ๅœ–)
    • # 88 Merge Sorted Array (ๆœ‰ๅœ–)
    • # 125 Valid Palindrome
    • #167 Two Sum II - Input array is sorted (ๆœ‰ๅœ–)
    • # 283 Move Zeroes (ๆœ‰ๅœ–)
    • # 38 Count and Say
    • # 557. Reverse Words in a String III
    • #977 Squares of a Sorted Array
    • #209 Minimum Size Subarray Sum
  • String
    • # 13 Roman to Integer (ๆœ‰ๅœ–)
    • # 771 Jewels and Stones
    • # 937 Reorder Data in Log Files
    • # 929 Unique Email Addresses
    • # 1108 Defanging an IP Address
    • #14 Longest Common Prefix
    • # 387 First Unique Character in a String (ๆœ‰ๅœ–)
    • #193 Valid Phone Numbers
    • # 28 Implement strStr()
    • #383 Ransom Note
  • Stack
    • # 20 Valid Parentheses (ๆœ‰ๅœ–)
    • # 155 Min Stack
    • BF 165. remove characters
    • #1047 Remove All Adjacent Duplicates In String
  • Binary Search
    • # 1064 Fixed Point (ๆœ‰ๅœ–)
    • # 852 Peak Index in a Mountain Array
  • Recursion ้ž่ฟด
    • #2625. Flatten Deeply Nested Array
  • Math
    • # 7 Reverse Integer
    • # 9 Palindrome Number (ๆœ‰ๅœ–)
    • #53 Maximum Subarray (ๆœ‰ๅœ–)
    • # 1085 Sum of Digits in the Minimum Number.
    • # 136 Single Number
    • # 204 Count Primes (ๆœ‰ๅœ–)
    • #243 Shortest Word Distance
  • Dynamic Programing
    • # 322 Coin Change
    • # 509 Fibonacci Number (ๆœ‰ๅœ–)
    • # 70 Climbing Stairs
    • # 198 House Robber
    • # 168. Excel Sheet Column Title
  • Others
    • # 205. Isomorphic Strings
    • Implement js Array method
    • Flatten Array/Object
  • Matrix
    • 867. Transpose Matrix
  • Queue
    • DOM tree with queue
  • ๆŽ’ๅบ
    • Different Sort
Powered by GitBook
On this page

Was this helpful?

  1. Tools

loop

for

ๅ–„็”จ Array destructuring ๅฏไปฅ่ฎ“ for loop ๆ›ดๆธ…ๆฅš๏ผŒMap ไนŸๅฏไปฅ็”จ for loop

var findWinners = function(matches) {
    let lookup = new Map()
    for( const [winner, loser] of matches){  }
    for(const [player, lose] of lookup){ }
  
};

findWinners([[1,3],[2,3],[3,6],[5,6],[5,7],[4,5],[4,8],[4,9],[10,4],[10,9]])
PreviousMath / DateNextJSON.xx / localStorage

Last updated 9 months ago

Was this helpful?