PikachuBLOG


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

3. Longest Substring Without Repeating Characters

发表于 2017-06-26 | 分类于 LeetCode | 阅读次数
字数统计 456 | 阅读时长 2

3. Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.

Examples:
Given “abcabcbb”, the answer is “abc”, which the length is 3.
Given “bbbbb”, the answer is “b”, with the length of 1.
Given “pwwkew”, the answer is “wke”, with the length of 3. Note that the answer must be a substring, “pwke” is a subsequence and not a substring.

阅读全文 »

2. Add Two Numbers

发表于 2017-06-22 | 分类于 LeetCode | 阅读次数
字数统计 376 | 阅读时长 2

2. Add Two Numbers

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 single digit.Add the two numbers and return it as a linked list.

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output : 7 -> 0 -> 8

阅读全文 »

1. Two Sum

发表于 2017-06-21 | 分类于 LeetCode | 阅读次数
字数统计 699 | 阅读时长 4

1. Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.

Example:

Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return[0, 1].

UPDATE(2016 / 2 / 13) :The return format had been changed to zero - based indices.Please read the above updated description carefully.

阅读全文 »

18. 4Sum

发表于 2017-06-20 | 分类于 LeetCode | 阅读次数
字数统计 623 | 阅读时长 3

18. 4Sum

       Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target ? Find all unique quadruplets in the array which gives the sum of target.

       Note : The solution set must not contain duplicate quadruplets.

For example, given array S = [1, 0, -1, 0, -2, 2], and target = 0.

A solution set is :
[
    [-1, 0, 0, 1],
    [-2, -1, 1, 2],
    [-2, 0, 0, 2]
]
阅读全文 »

快速排序的两种实现思路和非递归实现--C++实现

发表于 2017-06-20 | 分类于 Algorithm | 阅读次数
字数统计 1,049 | 阅读时长 5

思路一:

       第一种是根据算法导论上的思想:取数组的最后一个元素为主元,i初始化为最低位元素的前一个位置,j指向遍历数组中待排序的元素,当j所指元素比主元小的时候i= i + 1,然后交换i和j所指的元素,j不断遍历,遇到小于主元的就进行交换,这样就能一直维持这样一个序列,i之前的元素(包括i所指元素本身)都是比主元小的元素,i到j之间都是比主元大的元素,j(包括j所指元素)之后都是待排序的元素,最后交换主元和第一个比主元大的元素就可以完成划分。
       算法导论具体介绍如下:
           快速排序是基于分治模式处理的,对一个典型子数组A[p…r]排序的分治过程为三个步骤:

阅读全文 »

我的博客

发表于 2017-06-19 | 分类于 Hexo | 阅读次数
字数统计 83 | 阅读时长 1

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

阅读全文 »

测试分类和标签

发表于 2017-06-19 | 分类于 Hexo | 阅读次数
字数统计 83 | 阅读时长 1

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

阅读全文 »

Hello World

发表于 2017-06-19 | 分类于 Hexo | 阅读次数
字数统计 78 | 阅读时长 1

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"
阅读全文 »
1…1617
CodePikachu

CodePikachu

技术随笔

168 日志
5 分类
7 标签
RSS
GitHub Twitter 微博 知乎
0%
© 2015 - 2020 CodePikachu
博客全站共123.3k字
本站访客数:
由 Hexo 强力驱动
主题 - NexT.Pisces