欢迎来到PJCK的博客

随笔分类 -  Algorithm Problems

上一页 1 2 3 4 5 6 ··· 11 下一页
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2019-05-15 08:59 PJCK 阅读(152) 评论(0) 推荐(0)
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2019-05-14 22:33 PJCK 阅读(146) 评论(0) 推荐(0)
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2019-05-14 21:51 PJCK 阅读(89) 评论(0) 推荐(0)
摘要:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow an 阅读全文
posted @ 2019-05-10 21:15 PJCK 阅读(113) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combination, it 阅读全文
posted @ 2019-05-10 21:01 PJCK 阅读(128) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2019-05-10 19:19 PJCK 阅读(109) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: E 阅读全文
posted @ 2019-05-10 19:03 PJCK 阅读(106) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: 这是一个DP题,好像是线性DP吧。 官方题解有DP的 阅读全文
posted @ 2019-05-10 12:30 PJCK 阅读(152) 评论(0) 推荐(0)
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2019-05-10 09:39 PJCK 阅读(114) 评论(0) 推荐(0)
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2019-05-10 09:35 PJCK 阅读(109) 评论(0) 推荐(0)
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2019-05-10 09:31 PJCK 阅读(145) 评论(0) 推荐(0)
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2019-05-09 19:57 PJCK 阅读(165) 评论(0) 推荐(0)
摘要:In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on 阅读全文
posted @ 2019-05-07 13:06 PJCK 阅读(315) 评论(0) 推荐(0)
摘要:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor 阅读全文
posted @ 2019-05-07 11:36 PJCK 阅读(146) 评论(0) 推荐(0)
摘要:Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting paren 阅读全文
posted @ 2019-05-06 22:19 PJCK 阅读(122) 评论(0) 推荐(0)
摘要:Given an array A of integers, we must modify the array in the following way: we choose an i and replace A[i] with -A[i], and we repeat this process K  阅读全文
posted @ 2019-05-06 22:08 PJCK 阅读(105) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2019-05-06 21:32 PJCK 阅读(174) 评论(0) 推荐(0)
摘要:We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we 阅读全文
posted @ 2019-05-06 21:16 PJCK 阅读(145) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2019-05-06 20:37 PJCK 阅读(179) 评论(0) 推荐(0)
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2019-05-05 14:30 PJCK 阅读(129) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 11 下一页