CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1503. Last Moment Before All Ants Fall Out of a Plank

We have a wooden plank of the length n units. Some ants are walking on the plank, each ant moves with speed 1 unit per second. Some of the ants move to the left, the other move to the right. When two
2020-07-05
#leetcode #array #java #javascript #brainteaser

[LeetCode] 271. Encode and Decode Strings

Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings. Machine 1 (sender) has the function:
2020-07-05
#leetcode #java #javascript #string #design

[LeetCode] 38. Count and Say

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:countAndSay(1) = “1”countAndSay(n) is the way you would “say” the digit string from countAndSay(n-1), wh
2020-07-04
#leetcode #java #string #simulation

[LeetCode] 79. Word Search

Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are hor
2020-07-01
#leetcode #array #java #dfs #string #backtracking

[LeetCode] 332. Reconstruct Itinerary

You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of th
2020-06-30
#leetcode #java #dfs #graph #topological sort

[LeetCode] 279. Perfect Squares

Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer
2020-06-28
#leetcode #java #javascript #dynamic programming #math #knapsack

[LeetCode] 1014. Best Sightseeing Pair

You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them. The score of a pair (i < j)
2020-06-17
#leetcode #array #java #dynamic programming #greedy

[LeetCode] 787. Cheapest Flights Within K Stops

There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi to city toi with co
2020-06-15
#leetcode #java #bfs #graph #dijkstra #heap

[LeetCode] 392. Is Subsequence

Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none)
2020-06-10
#leetcode #two pointer #java #dynamic programming #greedy #binary search

[LeetCode] 300. Longest Increasing Subsequence

Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1:Input: nums = [10,9,2,5,3,7,101,18]Output: 4Explanation: The longest increasing subsequenc
2020-06-06
#leetcode #array #java #binary search #LIS #dp
1…2930313233…47

Search

Hexo Fluid