
leetcode
文章平均质量分 53
夜神月233
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
225.Implement Stack using Queues(C语言版本)
Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whet转载 2017-07-02 21:11:37 · 393 阅读 · 0 评论 -
7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note:The input is assumed to be a 32-bit signed integer. Your function should return 0 when the rever转载 2017-09-07 21:21:35 · 188 阅读 · 0 评论 -
67. Add Binary(C语言改进版)
与之前的版本的区别是,不需要转序。代码:char* addBinary(char* a, char* b) { int n, m; for (n=0; *a; a++, n++) ; for (m=0; *b; b++, m++) ; int length; if(m>n) { length原创 2017-07-17 20:22:34 · 449 阅读 · 0 评论 -
67. Add Binary(C语言版本)
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".巧妙的算法:char* addBinary(char* a, char* b) { int n, m; for (n=0;转载 2017-07-17 17:35:23 · 514 阅读 · 0 评论 -
125. Valid Palindrome(C语言版本)
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not原创 2017-07-17 15:07:59 · 378 阅读 · 0 评论 -
541. Reverse String II(C语言版本)
Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of th转载 2017-07-17 14:15:26 · 373 阅读 · 0 评论 -
232. Implement Queue using Stacks(C语言版本)(Time Limit Exceeded)
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(原创 2017-07-05 20:25:33 · 355 阅读 · 0 评论 -
496. Next Greater Element I(C语言版本)
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums转载 2017-07-05 16:03:43 · 288 阅读 · 0 评论 -
141. Linked List Cycle(C语言版本)
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * struct ListNode { * in转载 2017-06-29 11:52:42 · 339 阅读 · 0 评论 -
237. Delete Node in a Linked List(C语言版本)
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value原创 2017-06-29 15:35:14 · 226 阅读 · 0 评论 -
160. Intersection of Two Linked Lists(C语言版本)
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘原创 2017-06-29 17:48:47 · 276 阅读 · 0 评论 -
234. Palindrome Linked List(C语言版本)
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?解题思路: 1 首先,找到该链表的中心。 2 接着,将链表的后半部分反序。 3 接着,将前半部分与后半部分进行比较原创 2017-06-30 11:46:50 · 264 阅读 · 0 评论 -
9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.转载 2017-09-07 21:39:08 · 197 阅读 · 0 评论