![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
u010539271
这个作者很懒,什么都没留下…
展开
-
欢迎使用CSDN-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl原创 2017-01-02 19:52:30 · 247 阅读 · 0 评论 -
Remove Element
题目描述: Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.Th原创 2017-01-02 20:37:45 · 211 阅读 · 0 评论 -
LeetCode 112 Path Sum
题目要求 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary原创 2017-01-12 17:08:33 · 209 阅读 · 0 评论 -
欢迎使用CSDN-markdown编辑器
Total HammingDistance –Leetcode. The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance be原创 2017-02-23 16:18:31 · 219 阅读 · 0 评论 -
删除字符串中的空格
如题,例如“ a b c d “, 去除空格后变为”abcd”,要求时间复杂度为O(n)O(n),空间复杂度为O(1)O(1)。 * 那到这道题最开始想到的是用两个指针i,j,i指向第一个空格,j指向空格之后第一个不为空格的字符,然后交换,之后,i再寻找后边第一个等于空格的,j从i的后一个开始扫描。代码如下: public static void remove(char[] chs原创 2017-04-07 15:38:11 · 501 阅读 · 0 评论 -
LeetCode 494:Target Sum
You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol.Find out how many w原创 2017-04-01 16:29:49 · 255 阅读 · 0 评论 -
LeetCode 215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2, return 5. 解法一:该题原创 2017-04-02 18:21:13 · 211 阅读 · 0 评论