
牛客网-leetcode
李家少年
这个作者很懒,什么都没留下…
展开
-
穷举法:max-points-on-a-line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 析:此处的在一条直线上也包含斜的直线,因此分为水平竖直线、斜线两种情况。 如果是水平竖直线,直接以横坐标或纵坐标为参考作统计即可; 如果是斜线,得先把斜线定义成Line类,包含k b两个值, 之原创 2017-08-19 15:18:08 · 399 阅读 · 0 评论 -
动态规划、递归:word-break II
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s =”catsan原创 2017-08-19 09:08:11 · 418 阅读 · 0 评论 -
层次遍历、递归:jump-game
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you原创 2017-08-19 17:02:28 · 499 阅读 · 0 评论 -
动态规划:word-break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s =”leetcode”, dict =[“leet”, “co原创 2017-08-16 18:51:13 · 407 阅读 · 0 评论 -
字符串分割成字串都是回文
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s =”aab”, Return [ [“aa”,”b”],原创 2017-09-11 11:32:26 · 380 阅读 · 0 评论