
Leetcode
文章平均质量分 50
ivanmerlin
这个作者很懒,什么都没留下…
展开
-
Single Number
Given an array of integers, every element appears twice except for one. Find that single one.大意就是,别的数字都成双成对,只有一个数字孤身一人。【别名:寻找单身狗】Note:Your algorithm should have a linear runtime complexity翻译 2015-09-30 10:13:03 · 288 阅读 · 0 评论 -
Remove Element 100%哟
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.这原创 2015-09-17 14:31:05 · 327 阅读 · 0 评论 -
Reverse Linked List 翻转链表
Reverse a singly linked list.单向链表是个难点。一开始用栈来做,结果报了内存超过了。后来想到用指针来做。保存第二个元素的下一个节点,让他们依次反序指向即可/** * Definition for singly-linked list. * public class ListNode { * int val; *原创 2015-09-16 23:42:23 · 328 阅读 · 1 评论 -
Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...原创 2015-09-16 21:49:30 · 304 阅读 · 0 评论 -
Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2015-09-16 22:10:28 · 292 阅读 · 1 评论