10 2014 档案
摘要:题目描述:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For...
阅读全文
摘要:题目描述:Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order re...
阅读全文
摘要:文件描述符:进程通过文件描述符来操作文件,文件描述符可以通过open, openat, creat系统调用返回;shell和其他应用默认打开标准输入(STDIN_FILENO),标准输出(STDOUT_FILENO),标准错误(STDERR_FILENO)三个文件描述符。open和openat函数:...
阅读全文
摘要:0 导读 缩写:构造函数ctor 析构函数 dtor 1 让自己习惯C++ C++次语言:C, Object_Oriented C++, Template C++, STL 以const, enum, inline替换#define const 成员函数承诺绝对不改变其对象的...
阅读全文
摘要:题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4...
阅读全文
摘要:题目描述:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".解题方案: 1 class Solution { 2 public: 3 s...
阅读全文
摘要:题目描述:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a si...
阅读全文
摘要:题目描述:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transactio...
阅读全文
摘要:题目描述:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element....
阅读全文
摘要:题目描述:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra spac...
阅读全文
摘要:题目描述:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题方案:使用快慢指针,如果有环,快指针肯定会追上慢指针。下面是该题的代码...
阅读全文