随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页
摘要:A chess knight can move as indicated in the chess diagram below: . This time, we place our chess knight on any numbered key of a phone pad (indicated 阅读全文
posted @ 2019-03-27 21:51 Veritas_des_Liberty 阅读(334) 评论(0) 推荐(0) 编辑
摘要:Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first row, and ch 阅读全文
posted @ 2019-03-26 18:27 Veritas_des_Liberty 阅读(224) 评论(0) 推荐(0) 编辑
摘要:Your music player contains N different songs and she wants to listen to L (not necessarily different) songs during your trip. You create a playlist so 阅读全文
posted @ 2019-03-26 17:52 Veritas_des_Liberty 阅读(220) 评论(0) 推荐(0) 编辑
摘要:We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Note that '0' is not included.) Now, we write numbers 阅读全文
posted @ 2019-03-25 10:21 Veritas_des_Liberty 阅读(229) 评论(0) 推荐(0) 编辑
摘要:We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of al 阅读全文
posted @ 2019-03-25 09:19 Veritas_des_Liberty 阅读(250) 评论(0) 推荐(0) 编辑
摘要:You are given K eggs, and you have access to a building with N floors from 1 to N. Each egg is identical in function, and if an egg breaks, you cannot 阅读全文
posted @ 2019-03-24 16:29 Veritas_des_Liberty 阅读(239) 评论(0) 推荐(0) 编辑
摘要:There are G people in a gang, and a list of various crimes they could commit. The i-th crime generates a profit[i] and requires group[i] gang members 阅读全文
posted @ 2019-03-23 16:17 Veritas_des_Liberty 阅读(291) 评论(0) 推荐(0) 编辑
摘要:A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive 阅读全文
posted @ 2019-03-23 12:45 Veritas_des_Liberty 阅读(253) 评论(0) 推荐(0) 编辑
摘要:An undirected, connected graph of N nodes (labeled 0, 1, 2, ..., N-1) is given as graph. graph.length = N, and j != i is in the list graph[i] exactly 阅读全文
posted @ 2019-03-22 21:37 Veritas_des_Liberty 阅读(262) 评论(0) 推荐(0) 编辑
摘要:There are N dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t 阅读全文
posted @ 2019-03-22 21:04 Veritas_des_Liberty 阅读(316) 评论(0) 推荐(0) 编辑
摘要:We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the larges 阅读全文
posted @ 2019-03-21 17:52 Veritas_des_Liberty 阅读(276) 评论(0) 推荐(0) 编辑
摘要:We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the s 阅读全文
posted @ 2019-03-19 21:47 Veritas_des_Liberty 阅读(399) 评论(0) 推荐(0) 编辑
摘要:We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated. Given N, how many ways are there to tile a 2 x 阅读全文
posted @ 2019-03-19 20:47 Veritas_des_Liberty 阅读(298) 评论(0) 推荐(0) 编辑
摘要:In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-alig 阅读全文
posted @ 2019-03-18 22:26 Veritas_des_Liberty 阅读(284) 评论(0) 推荐(0) 编辑
摘要:1012. Complement of Base 10 Integer Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 阅读全文
posted @ 2019-03-17 17:19 Veritas_des_Liberty 阅读(234) 评论(0) 推荐(0) 编辑
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2019-03-15 12:27 Veritas_des_Liberty 阅读(322) 评论(0) 推荐(0) 编辑
摘要:In a N x N grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through; 1 m 阅读全文
posted @ 2019-03-15 09:44 Veritas_des_Liberty 阅读(269) 评论(0) 推荐(0) 编辑
摘要:Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points 阅读全文
posted @ 2019-03-14 22:13 Veritas_des_Liberty 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2.len 阅读全文
posted @ 2019-03-14 20:53 Veritas_des_Liberty 阅读(222) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all 阅读全文
posted @ 2019-03-14 18:46 Veritas_des_Liberty 阅读(229) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页