CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1615. Maximal Network Rank

There is an infrastructure of n cities with some number of roads connecting these cities. Each roads[i] = [ai, bi] indicates that there is a bidirectional road between cities ai and bi. The netwo
2020-10-11
#leetcode #java #graph

[LeetCode] 611. Valid Triangle Number

Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.Example 1:Input: nums = [2,2,3,4]Output: 3Ex
2020-10-02
#leetcode #array #two pointer #java #greedy #sort

[LeetCode] 229. Majority Element II

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Example 1:Input: nums = [3,2,3]Output: [3] Example 2:Input: nums = [1]Output: [1] Example 3:Inpu
2020-09-23
#leetcode #array #java #javascript

[LeetCode] 979. Distribute Coins in Binary Tree

You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree. In one move, we may choose two adjacent nodes
2020-09-22
#leetcode #java #tree #dfs #postorder

[LeetCode] 1291. Sequential Digits

An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers in the range [low, high] inclusive that have sequ
2020-09-20
#leetcode #java #bfs #dfs #enumeration

[LeetCode] 421. Maximum XOR of Two Numbers in an Array

Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n.Example 1:Input: nums = [3,10,5,25,2,8]Output: 28Explanation: The maximum r
2020-09-17
#leetcode #java #bit manipulation #trie

[LeetCode] 875. Koko Eating Bananas

Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Koko can decide her bananas-per-hour eating speed of
2020-09-09
#leetcode #array #java #binary search #binary search on answer

[LeetCode] 429. N-ary Tree Level Order Traversal

Given an n-ary tree, return the level order traversal of its nodes’ values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null
2020-09-07
#leetcode #java #tree #bfs

590. N-ary Tree Postorder Traversal

Given the root of an n-ary tree, return the postorder traversal of its nodes’ values. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated b
2020-08-13
#leetcode #java #tree #postorder #n-ary tree

[LeetCode] 622. Design Circular Queue

Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the last positio
2020-08-03
#leetcode #array #java #design #queue
1…2425262728…41

Search

Hexo Fluid