
algorithm
文章平均质量分 68
philip_puma
6年嵌入式Linux经验。尤其熟悉Am335x类CPU,理解驱动,Uboot,内核,文件系统原理。
音视频编解码,播放器制作等。C++ Qt跨平台软件开发。
展开
-
【算法导论】分治法
一. 前言看了分治法的部分,原创 2014-05-16 23:24:30 · 519 阅读 · 0 评论 -
【Leetcode】3Sum
问题Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triple原创 2014-05-30 11:25:06 · 596 阅读 · 0 评论 -
【Leetcode】Letter Combinations of a Phone Number
问题Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Inpu原创 2014-05-30 11:43:54 · 633 阅读 · 0 评论 -
【Leetcode】Remove Nth Node From End of List
问题代码class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { if (!head) { return head; } ListNode *temp = head; ListNode *probe = NULL; ListNode *prev =原创 2014-05-30 11:49:56 · 577 阅读 · 0 评论 -
【Leetcode】Generate Parentheses
问题代码分析总结原创 2014-05-30 12:00:45 · 799 阅读 · 0 评论 -
【Leetcode】4Sum
问题代码分析分析2总结原创 2014-05-30 11:32:33 · 572 阅读 · 0 评论 -
【Leetcode】Longest Common Prefix
问题代码class Solution {public: string longestCommonPrefix(vector &strs) { int len = strs.size(); if (len == 1) { return strs[0]; } if (len == 0) { return ""; } st原创 2014-05-30 11:14:28 · 608 阅读 · 0 评论 -
【Leetcode】Container With Most Water
问题代码分析总结原创 2014-05-30 11:10:29 · 551 阅读 · 0 评论 -
【Leetcode】Valid Parentheses
问题Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are原创 2014-05-30 11:54:05 · 632 阅读 · 0 评论 -
【Leetcode】Remove Duplicates from Sorted Array
问题代码class Solution {public: int removeDuplicates(int A[], int n) { if (n == 0 || n == 1) { return n; } int flag = A[0]; int slot = 1; for (int i = 1 ; i < n ; i++) {原创 2014-06-16 00:14:53 · 531 阅读 · 0 评论 -
【Leetcode】Implement strStr()
问题Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.代码int hashCode(char* needle , int c){ int hashcode = 0;原创 2014-06-16 00:19:32 · 472 阅读 · 0 评论 -
【Leetcode】Swap Nodes in Pairs
问题Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant原创 2014-06-16 00:10:56 · 467 阅读 · 0 评论 -
【Leetcode】Reverse Nodes in k-Group
问题Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain原创 2014-06-16 00:13:26 · 462 阅读 · 0 评论 -
【Leetcode】3Sum Closest
问题代码分析总结原创 2014-05-30 11:38:48 · 558 阅读 · 0 评论 -
【Leetcode】Regular Expression Matching
问题Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire原创 2014-05-30 11:03:41 · 561 阅读 · 0 评论 -
【Leetcode】String to Integer (atoi)
问题Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible原创 2014-05-23 00:20:20 · 476 阅读 · 0 评论 -
Mac 下运用LLDB 搭建编译环境
Mac下GDB不太好用在Mac下使用gdb调试bi原创 2014-05-15 16:55:06 · 2195 阅读 · 0 评论 -
【算法导论】归并排序,C语言实现
void merge(int* A , int p , int q , int r){ static int counter =0; printf("%d st int here\n" , counter ++); /* create two arrays */ int LASize = (q - p + 1); int RaSize = (r - q +原创 2014-05-16 22:45:42 · 521 阅读 · 0 评论 -
【Leetcode】TwoSum
//// toSum.cpp// Test//// Created by mac on 5/18/14.// Copyright (c) 2014 mac. All rights reserved.//#include "toSum.h"#include #include #include using namespace std;struct node{原创 2014-05-18 23:05:41 · 486 阅读 · 0 评论 -
【Leetcode】Longest Substring Without Repeating Characters
问题:代码://// lssworc.cpp// Test//// Created by mac on 5/19/14.// Copyright (c) 2014 mac. All rights reserved.//#include "lssworc.h"#include #include #include using namespace std;原创 2014-05-20 00:01:10 · 458 阅读 · 0 评论 -
【Leetcode】Add Two Numbers
问题:代码:分析:总结:原创 2014-05-20 00:08:53 · 398 阅读 · 0 评论 -
【Leetcode】Median of Two Sorted Arrays
问题:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).代码:分析:总结:原创 2014-05-20 00:42:40 · 442 阅读 · 0 评论 -
【Leetcode】Longest Palindromic Substring Part
问题代码分析总结原创 2014-05-20 23:42:53 · 394 阅读 · 0 评论 -
【C++ STL Map】遍历
问题代码分析jieg原创 2014-06-04 23:58:22 · 1631 阅读 · 0 评论 -
【Leetcode】Merge k Sorted Lists
问题代码分析总结原创 2014-06-05 00:37:17 · 541 阅读 · 0 评论 -
【Leetcode】ZigZag Conversion
问题:ZigZag原创 2014-05-23 00:00:14 · 494 阅读 · 0 评论 -
【Leetcode】Reverse Integer
问题Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321代码分析总结原创 2014-05-23 00:12:02 · 418 阅读 · 0 评论 -
【Leetcode】Palindrome Number
问题代码分析总结原创 2014-05-23 00:25:40 · 444 阅读 · 0 评论 -
【Leetcode】Remove Element
问题代码class Solution {public: int removeElement(int A[], int n, int elem) { if (n == 0) { return n; } int slot = 0; for (int i = 0 ; i < n ; i++) { if (elem == A[i]) { con原创 2014-06-16 00:16:01 · 446 阅读 · 0 评论