CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 720. Longest Word in Dictionary

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible a
2020-10-29
#leetcode #hashmap #java #sort #string #trie

[LeetCode] 524. Longest Word in Dictionary through Deleting

Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, retur
2020-10-29
#leetcode #array #two pointer #java #sort

[LeetCode] 1051. Height Checker

A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer
2020-10-28
#leetcode #array #java #sort #bucket sort

[LeetCode] 948. Bag of Tokens

You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] donates the value of tokeni. Your goal is to maximize the to
2020-10-26
#leetcode #two pointer #java #greedy #sort

[LeetCode] 456. 132 Pattern

Given a sequence of n integers a1, a2, …, an, a 132 pattern is a subsequence ai,aj, ak such that i < j < k and ai < ak < aj. Design an algorithm that takes a listof n numbers as input and
2020-10-24
#leetcode #java #treemap #stack #monotonic stack

[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
1…2425262728…43

Search

Hexo Fluid