Leetcode
文章平均质量分 94
JokerCK
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode-Can Place Flowers
leetcode- Can place flowers原创 2017-09-22 23:13:40 · 314 阅读 · 0 评论 -
Leetcode-Pascal's triangle
杨辉三角的问题:Pascal’s triangle I第一题,简单的输出杨辉三角, Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1],原创 2017-10-13 23:40:58 · 296 阅读 · 0 评论 -
Leetcode-Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possibl原创 2017-10-22 17:25:00 · 310 阅读 · 0 评论 -
Leetcode-Pascal's triangle
杨辉三角: Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]原创 2016-10-24 23:23:44 · 182 阅读 · 0 评论 -
leetcode-Non-decreasing Array
Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] <= array[i + 1] holds for eve原创 2017-10-18 19:07:49 · 246 阅读 · 0 评论 -
Leetcode-rotate array
旋转数组, Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].非常简单,如果不考虑空间的话,很容易写出O(N)的空间复杂度的代码:void rota原创 2017-09-21 22:32:56 · 239 阅读 · 0 评论 -
Leetcode- Remove Duplicates from Sorted Array
这几天做的几道数组de简单题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do原创 2017-09-21 18:12:55 · 193 阅读 · 0 评论 -
leetcode - TwoSum
最简单的一道题开始刷题之旅。。。 Given an array of integers, return indices of the two numbers such that they add up to a specific target. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] +原创 2017-09-12 23:31:14 · 298 阅读 · 0 评论 -
KMP算法解析
字符串匹配,一个老生常谈的问题。常见的问题是在源字符串S中查找模式字符串P,若存在,则返回P第一次出现的位置。 抛开效率不谈,任何问题都有一个暴力解法,当我们无法容忍暴力解法所带来的低效时,伟大的科学家们便开始研究如何提高效率,各种高效、令人称奇的算法便诞生了。 本文参考JULY的博客字符串查找-暴力解法存在字符串S和P,要求在S中查找P,若存在则返回P在S中第一次出现的位置,若不存在返回-1。原创 2017-08-28 19:28:25 · 359 阅读 · 0 评论 -
大话数据结构之AVL树
引言AVL(Adelson-Velskii和E.M Landis)树,作为一种最老的平衡查找树。原创 2017-09-24 14:47:33 · 685 阅读 · 1 评论 -
Leetcode-Best Time to Buy and Sell Stock
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 (ie, buy one and sell one share of the stock),原创 2017-10-24 14:27:29 · 275 阅读 · 0 评论
分享