- 博客(22)
- 资源 (3)
- 收藏
- 关注
原创 【LeetCode】236. Lowest Common Ancestor of a Binary Tree
【题目】Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between
2017-09-17 22:09:59 177
原创 【LeetCode】165. Compare Version Numbers
【题目】Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-em
2017-09-16 17:15:02 200
原创 【LeetCode】198. House Robber
【题目】You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adja
2017-09-16 16:36:08 239
原创 【LeetCode】653. Two Sum IV - Input is a BST
【题目】Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input: 5 / \ 3
2017-09-02 15:47:39 559
原创 【Leetcode】Min Stack
【题目】Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top
2016-04-13 13:34:46 170
转载 程序员技术练级攻略
原文:月光博客6月12日发表了《写给新手程序员的一封信》,翻译自《An open letter to those who want to start programming》,我的朋友(他在本站的id是Mailper)告诉我,他希望在酷壳上看到一篇更具操作性的文章。因为他也是喜欢编程和技术的家伙,于是,我让他把他的一些学习Python和Web编程的一些点滴总结一下。于是他给我发来了一些
2014-07-22 17:33:15 319
转载 写给新手程序员的一封信
首先,欢迎来到程序员的世界。在这个世界上,不是有很多人想创造软件并解决问题。你是一名hacker,属于那些愿意做一些有挑战性的事情的人。 “当你不创造东西时,你只会根据自己的感觉而不是能力去看待问题。” – WhyTheLuckyStiff 对于下面的文字你不必完全接受,所有这些来自一个其貌不扬的程序员。我喜欢把事情做到最好,而不是对原来的东西修修补补。 仅仅是因为爱好开始做一些
2014-07-22 17:31:04 301
原创 【Leetcode】Substring with Concatenation of All Words
【题目】You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and
2014-07-19 16:09:41 279
原创 【Leetcode】Add Binary
【题目】Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".【代码】class Solution {public: string addBinary(string a, string b)
2014-07-15 01:22:44 332
原创 【Leetcode】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 ha
2014-07-14 21:40:35 284
原创 【Leetcode】Count and Say
【题目】The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is re
2014-07-14 13:11:11 290
原创 【Leetcode】Word Break II
【题目】Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, gi
2014-06-08 13:49:50 356
原创 【Leetcode】Linked List Cycle
【题目】Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?【代码】
2014-06-02 19:37:47 397
原创 【Leetcode】Sort List
【题目】Sort a linked list in O(n log n) time using constant space complexity.【代码】/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Lis
2014-06-02 11:18:21 416
原创 【Leetcode】Insertion Sort List
【题目】Sort a linked list using insertion sort.【
2014-06-02 10:57:15 436
原创 【Leetcode】Reverse Integer
【题目】【代码】class Solution {public: int reverse(int x) { int result=0; bool pos=true; if(x<0){ pos=false; x=-x; } while(x){ result=result*10+x%
2014-05-18 15:17:50 316
原创 【Leetcode】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 N
2014-05-18 14:49:34 290
原创 【Leetcode】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.【代码】
2014-05-18 12:21:05 328
原创 【Leetcode】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 a
2014-05-13 17:00:21 303
转载 leetcode难度及面试频率
1Two Sum25arraysort setTwo Pointers2Add Two Numbers34linked listTwo Pointers
2014-04-18 10:43:55 309
原创 jsp页面文本输入框输入参数状态保持
【问题描述】最近用struts2框架做搜索页面的时候,jsp页面文本输入框的参数需要同时传到后台两个action进行处理,其中一个action负责返回json数据,一个action跳转到前端页面,出现问题是负责返回json数据的action接受参数异常,常常接受到的参数为空。【解决办法】之所以出现上述问题,原因是点击搜索按钮后,输入框参数为空,没有保持状态。解决方案有二:1.使用str
2014-02-13 10:51:13 1244
原创 java代码引用路径
在java代码中读取其他配置文件的时候路径应该怎样写呢?上网一查,结果如下:经过测试发现,上述方法得到的编译前的路径,在java类测试的时候是可以使用的。但是在eclipse开发项目的时候,往往系统编译后的类目录中去找配置文件,这时上述方法无能为力了,经多次尝试,终于修成正果,应该这样:private static String indexXmlPath=Thread.
2013-07-04 10:16:13 769
Embedding-based Retrieval in Facebook Search
2021-01-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人