随笔分类 -  Algorithm

摘要:238. Product of Array Except Self Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product o 阅读全文
posted @ 2016-04-11 23:23 水月心刀 阅读(185) 评论(0) 推荐(0)
摘要:104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from th 阅读全文
posted @ 2016-04-09 11:15 水月心刀 阅读(155) 评论(0) 推荐(0)
摘要:3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. For example, 阅读全文
posted @ 2016-04-09 10:43 水月心刀 阅读(146) 评论(0) 推荐(0)
摘要: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 node 阅读全文
posted @ 2016-04-09 09:43 水月心刀 阅读(161) 评论(0) 推荐(0)
摘要:338. Counting Bits Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary r 阅读全文
posted @ 2016-04-06 22:57 水月心刀 阅读(196) 评论(0) 推荐(0)
摘要:258. Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the 阅读全文
posted @ 2016-04-06 22:55 水月心刀 阅读(122) 评论(0) 推荐(0)
摘要:136. Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a li 阅读全文
posted @ 2016-04-06 22:54 水月心刀 阅读(132) 评论(0) 推荐(0)
摘要: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 wo 阅读全文
posted @ 2016-04-06 19:06 水月心刀 阅读(117) 评论(0) 推荐(0)
摘要:1、debug下手写快排效率为sort的10倍 2、release下sort略快于手写快排(相比debug均有极大提高) 3、stable_sort 在debug下比sort快 release下比sort慢 原因不明。 1 #pragma once 2 #include "stdafx.h" 3 # 阅读全文
posted @ 2015-12-23 14:12 水月心刀 阅读(197) 评论(0) 推荐(0)