自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 [LeetCode]Add Binary&Climbing Stairs&Remove Duplicates from Sorted List

今天写得蛮快的,来个三连发。Add Binary Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100".题意:二进制加法. 解法:把两个串都倒过来(低位先加).然后模拟一下就好了.注意最后也要进位就好.

2015-11-18 13:33:55 403

原创 [LeetCode]Length of Last Word&Plus One

发现还早,并没有睡意,再看了一眼后面的Easy,发现很快,so,写了吧,为了节约能源,把两题合在一起Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the str

2015-11-17 13:31:12 350

原创 [LeetCode] Count and Say

Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21.

2015-11-17 13:13:59 311

原创 [LeetCode] Valid Sudoku

Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.

2015-11-16 19:59:52 358

原创 [LeetCode] Implement strStr()[字符串hash]

题目:Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题意:实现strStr,给两个串A和B,总B是不是A的子串,如果是,返回第一个子串的起始位置,

2015-11-14 13:43:51 408

原创 [LeetCode] Remove Duplicates from Sorted Array & Remove Element

Remove Duplicates from Sorted ArrayRemove Element发现这两题性质差不多,于是就一起写了吧.Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once a

2015-11-12 13:24:52 347

原创 [LeetCode] Merge Two Sorted Lists

Merge Two Sorted Lists这貌似也一个常见的面试题.合并两个有序链表.尽量的占用空间少。 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解法:

2015-11-11 13:13:43 346

原创 [LeetCode] Valid Parentheses

Valid ParenthesesLeetCode20 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the correct order, “

2015-11-10 13:29:38 312

原创 [LeetCode] Remove Nth Node From End of List

Remove Nth Node From End of List写完最长前缀,看了一眼下一个easy,发现是个几行代码的题。so,写了吧。 题目: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked

2015-11-09 13:46:38 341

原创 [LeetCode] Longest Common Prefix

[LeetCode] Longest Common Prefix上一个easy的是那个罗马数字转int。我还百度了一下规则,感觉太恶心了这种模拟题,跳过好了..今天写了最长公共前缀 Write a function to find the longest common prefix string amongst an array of strings. *解法:如果为空的话,肯定是返回空串了。如

2015-11-09 13:20:12 307

原创 [LeetCode]:String to Integer (atoi)

按Easy顺序刷..刚开始就遇见了面试最常见的一个题了,去年我记得也遇到过,当初答得发水的,今天都又被坑了好几发. Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, plea

2015-11-06 13:34:12 326

原创 [LeetCode]:Reverse Integer(Only两类解法)

Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 题目大意比较简单,就是把一个整数反转,这个比较容易,但需要注意的是,返转过后,有可能溢出,所以这题的坑就是在溢出这里。 解法一:先把result定义成long long直接翻转,最

2015-11-05 13:13:25 498

原创 [LeetCode]:ZigZag Conversion

今天开始写下LeetCode.然后按顺序搬到这里和github吧,旨在更短,更效率,同时要便于理解. [ZigZag Conversion] The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to disp

2015-11-04 13:38:41 374

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除