rockettttman

  • 홈
  • 태그
  • 방명록

Algorithm 2

leetcode - 103. Binary Tree Zigzag Level Order Traversal

BFS (breadth first search) Input: root = [3,9,20,null,null,15,7] Output: [[3],[20,9],[15,7]] /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val===undefined ? 0 : val) * this.left = (left===undefined ? null : left) * this.right = (right===undefined ? null : right) * } */ /** * @param {TreeNode} root * @return {number[][]} */ var zigzagLevelOrder = f..

알고리즘 2021.03.24

Leetcode - Kth Largest Element in an Array(215)

JS heap priority queue - javascript 로 heap 우선순위 큐 알고리즘 풀이 /** * @param {number[]} nums * @param {number} k * @return {number} */ var findKthLargest = function(nums, k) { if(nums.length == 1) { return nums[0]; } //k가 1일 때 nums Array에서 바로 max값 return if(k === 1) { var maxNum = 0; return nums.reduce((bef, cur) => { console.log(bef + ", " + cur) return max = Math.max(maxNum, bef, cur) }); } var queu..

알고리즘 2021.03.05
이전
1
다음
더보기

  • 분류 전체보기 (53)
    • Mobile (4)
      • react-native (2)
      • Flutter (1)
      • iOS (1)
    • Web (25)
      • spring (0)
      • javascript (15)
      • css (2)
      • react (1)
      • frontend (2)
      • vue (5)
    • java (3)
    • python (1)
    • DB (1)
    • Network (1)
    • Linux (1)
    • 개발상식 (11)
    • 알고리즘 (2)
    • git (4)

Tag

Vue, ReactNative, ducks pattern, map, JavaScript, Setup, vue3, redux, hoisting, attrr, webpack, priority queue, async/await, breadth-first search, moking test, 비구조화, router-link, git, Algorithm, React,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

Copyright © Kakao Corp. All rights reserved.

티스토리툴바