- 博客(85)
- 资源 (7)
- 收藏
- 关注
原创 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f
2015-09-20 16:53:06
743
原创 Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.s
2015-09-18 13:55:30
567
原创 Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2015-09-18 11:46:32
556
原创 Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?solution: two pointers, one pointer step 1, the other pointer step 2, find t
2015-09-08 18:39:40
478
原创 Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may a
2015-09-08 15:16:58
537
原创 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 space. Y
2015-09-06 12:15:29
437
原创 Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.solution: 这道题是merge 2 sorted linked lists的扩展,从2-》K的问题,很多可以化为分治法(divide and conquer)求解。假设每个list都是n长
2015-09-06 11:01:26
408
原创 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()
2015-09-01 22:47:30
424
原创 Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.solution: use recursive method.#include /** * Defin
2015-08-31 17:39:55
484
原创 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 all va
2015-08-31 15:15:03
386
原创 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2015-08-31 13:09:35
390
原创 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:Element
2015-08-31 11:38:58
418
原创 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.Input:Digi
2015-08-28 11:14:44
577
原创 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact
2015-08-28 10:28:54
407
原创 3Sums
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 triplet (a,b,c
2015-08-27 17:14:36
588
原创 Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.class Solution {public: string longestCommonPrefix(vector& strs) { if(strs.size() == 0)
2015-08-27 11:48:58
394
原创 Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.#include class Solution {public: int charToInt(const char roman){ s
2015-08-26 17:55:56
408
原创 Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.查表法:class Solution {public: string intToRoman(int num) { string roman
2015-08-26 15:40:58
566
原创 Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin
2015-08-26 14:29:19
363
原创 Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.class Solution {public: bool isPalindrome(int x) { int inverseX = 0; int value = 0; if(x < 0){
2015-08-24 18:25:21
412
原创 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 input ca
2015-08-24 17:53:56
446
原创 Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c
2015-08-24 16:05:43
423
原创 ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I
2015-08-24 14:09:30
551
原创 Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 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)).Solution: 求两个有序数组的中位数,采用分
2015-07-28 22:21:46
747
原创 Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.Solution: 用二维矩阵p存储
2015-07-28 22:17:37
386
原创 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 link
2015-07-08 22:07:16
530
原创 Two Sum
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 to the target, whe
2015-07-07 23:04:32
601
原创 caffe tools command
1. compute the mean image.#!/usr/bin/env sh# Compute the mean image from the imagenet training leveldb# N.B. this is available in data/ilsvrc12./build/tools/compute_image_mean /mnt_data/yilin_gu
2015-05-13 15:53:43
1897
原创 leetcode: Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares
2015-05-11 15:07:45
648
原创 leetcode 之 Reverse Linked List
Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class So
2015-05-11 11:21:30
2286
原创 Beyond Frontal Faces: Improving Person Recognition Using Multiple Cues
最近阅读到Facebook AI实验室发的一篇文章,Beyond Frontal Faces: Improving Person Recognition Using Multiple Cues,主要用来做person recognition。 论文提到,传统的deepface适用于正脸(frontal face)的情形,但是对于侧脸、脸部有遮挡、背脸的情形下,效果不理想,论文作者提到利用身体的各个
2015-03-30 21:31:46
1805
1
原创 cuDNN: efficient Primitives for Deep Learning 论文阅读笔记
这篇论文主要讨论如何针对CNN做一些GPU矩阵计算的优化。传统CNN计算主要开销是在convolutions, activation function, pooling.首先,我们看convolution的操作过程:参数表:O是输出input feature map,F是filter, D0是input feature map. 从公式看到如果用循环操作,需要7次循
2015-03-12 16:41:09
4504
原创 Caffe SGD shuffle mechanism
As we know, the SGD need to shuffle all data in an epoch(the number of data), and read data sequentially batch by batch. How Caffe implement the shuffle mechanism?The input data format of caffe
2015-02-28 14:08:04
5366
转载 practice experience of deep learning from Ilya Sutskever
Practical Advice.Ok. So you’re sold. You’re convinced that LDNNs are the present and the future and you want to train it. But rumor has it that it’s so hard, so difficult… or is it? The reality is
2015-01-26 13:53:50
1201
原创 caffe c++ 抽取图片特征
caffe c++批量抽取特征的方法在[1],但是该方法使用中有几个疑问:1. 如何转换levelDB 格式为libsvm格式。2. ./build/tools/extract_features mini-batch 是代表什么意思,和imagenet_val.prototxt中的batch_size的关系是什么?
2015-01-19 22:47:00
22278
6
原创 caffe python visualization程序解析
本文主要对http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/filter_visualization.ipynb进行代码解析。1. net.blobs.items() 存储了预测图片的网络中各层的feature map的数据。2. net.params.items()存储了训练结束后学习好的网络参数。3
2015-01-19 15:35:42
9474
6
Software Architecture4+1
2009-03-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人