![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode and Algorithm
life_爱水的鱼
这个作者很懒,什么都没留下…
展开
-
[LeetCode 8] String to Integer(atoi)
Describe: Implement atoi to convert a string to an integer.原创 2015-09-02 14:40:09 · 397 阅读 · 0 评论 -
strtok源码剖析 位操作与空间压缩【转载】
strtok源码剖析 strtok函数可以用于分隔字符串,最近看了下这个函数的源代码转载 2015-09-16 01:23:17 · 473 阅读 · 0 评论 -
【LeetCode 232: Implement Queue using Stacks】
Description:Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue.原创 2015-09-14 23:05:54 · 298 阅读 · 0 评论 -
【LeetCode 237:Delete Node in a Linked List】
Decription: 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 w原创 2015-09-12 22:46:50 · 346 阅读 · 0 评论 -
【LeetCode 1 : Two Sum】
Description: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up.原创 2015-09-07 08:45:43 · 417 阅读 · 0 评论 -
【LeetCode 206: Reverse Linked List】
Description:Reverse a singly linked list.Hint: A linked list can be reversed either iteratively or recursively. Could you implement both?代码实现:/** * Definition for singly-linked list. * struct ListNo原创 2015-09-13 00:27:24 · 311 阅读 · 0 评论 -
【SeqList】线性表代码实现总结
前言: 本文是在学习了线性表的实现后,理解国嵌数据结构与算法教程后,自己实现的线性表这种简单的数据结构,并且是可复用于任意类型数据原创 2015-09-08 00:33:22 · 3347 阅读 · 0 评论 -
常见排序算法
排序算法作为常用的基本算法,今天就来总结一下各种经典排序算法,这里只贴出代码,对算法的文字描述可以在课本或其它博客上找到很多详尽的叙述,这里直接上代码而不是常见算法书上的伪代码,希望对正在努力学数据结构与算法的朋友们有帮助原创 2015-09-06 15:31:39 · 351 阅读 · 0 评论 -
【LeetCode 153: Find Minimum in Rotated Sorted Array】
查找旋转数组的最小值Description:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element.原创 2015-09-27 11:29:56 · 376 阅读 · 0 评论 -
链表常见操作【整理自剑指offer及csdn】
1:单链表的节点定义:struct ListNode{ int m_nValue; ListNode *m_pNext;};2:向链表末尾中添加一个节点:void AddToTail(ListNode** pHead, int value){ ListNode *pNew = new ListNode(); pNew->m_nValue = value;原创 2015-09-22 00:03:09 · 472 阅读 · 0 评论 -
零子数组
Description:相对于长度为N的数组A, 求子数组的和最接近0的值: 比如:数组A: 1, -2, 3, 10, -4, 7, 2, -5它对应的所有子数组中,和最接近0的是:0 对应的子数组是: -4, 7, 2, 5原创 2015-09-27 12:12:14 · 462 阅读 · 0 评论 -
【LeetCode 7: Reverse Integer】
Description:Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this? Here are some good questions to ask before coding. Bonus points for原创 2015-09-27 13:00:55 · 296 阅读 · 0 评论 -
【LeetCode 88 】 Merge Sorted Array
题目: LeetCode 88 Merge Sorted Array 合并两个有序数组,使得合并后有序Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough spac原创 2015-09-05 20:00:20 · 343 阅读 · 0 评论 -
字符串替换空格算法
题目: 请实现一个函数,吧字符串中的每个空格替换成“%20”原创 2015-09-04 21:22:02 · 421 阅读 · 0 评论 -
前言
作为一名码农,【现在渣渣的自己还算不上合格的码农】,数据结构与算法的学习以及思想的感受与领悟还是很重要的,期待自己也可以强大到对算法熟悉,融会贯通的程度,哈哈,YY一下哈,接下来,在博客里每天至少学习一个算法或数据结构,总结到博客中进行记录,也以此篇前言以监督自己,好好学习,要有果断的执行力和坚定的决心; 接下来的算法学习暂定的学习资料会来源于一些博客,书本的学习和总结,也相当于读书笔记吧,在此也原创 2015-09-02 00:49:25 · 358 阅读 · 0 评论 -
Fibonacci(斐波那契)序列学习总结
题目:写一个函数,输入n,求斐波那契数列的第n项,斐波那契数列的定义如下: Fib(n) = Fib(n-1) + Fib(n-2), n>1; Fib(0) = Fib(1) = 1;也有一些定义是这样的: // 这种定义就不包括第0项 Fib(n) = Fib(n-1) + Fib(n-2); Fib(1) == Fib(2) == 1; // 本文给出两种原创 2015-09-03 01:24:08 · 1140 阅读 · 0 评论 -
位运算相关总结
1)考虑进制问题: 题目:在Excel 2003中,用A表示第1列,B表示第2列。。。Z表示第26列,AA表示第27列, AB表示第28列。。。以此类推,请写出一个函数,输入用字母表示的列好编码,输出它是第几列?原创 2015-09-03 10:31:15 · 405 阅读 · 0 评论 -
字符串替换
/*Description: change string : for example: "hello" -> "he2lo"*/#include<iostream>using namespace std;void changeString(char str[], int n){ int indexWrite = 0; int indexRea原创 2015-09-21 00:03:45 · 351 阅读 · 0 评论