随笔分类 -  LeetCode

摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文

posted @ 2016-04-20 16:08 徐岩 阅读(115) 评论(0) 推荐(0)

摘要:Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + 阅读全文

posted @ 2016-04-12 16:34 徐岩 阅读(546) 评论(0) 推荐(0)

摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文

posted @ 2016-04-12 14:53 徐岩 阅读(120) 评论(0) 推荐(0)

摘要: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 endpo 阅读全文

posted @ 2016-04-12 14:51 徐岩 阅读(107) 评论(0) 推荐(0)

摘要:Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Solution 1: 阅读全文

posted @ 2016-04-12 14:36 徐岩 阅读(111) 评论(0) 推荐(0)

摘要:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. roman numerals: https://en.wikipedia.org/w 阅读全文

posted @ 2016-04-12 14:27 徐岩 阅读(114) 评论(0) 推荐(0)

摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [1,3,2]. Solution 1: Solution 阅读全文

posted @ 2016-04-12 11:20 徐岩 阅读(102) 评论(0) 推荐(0)

摘要:Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [1,2,3]. Solution 1: (递归) Sol 阅读全文

posted @ 2016-04-12 11:17 徐岩 阅读(103) 评论(0) 推荐(0)

摘要:Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文

posted @ 2016-04-07 22:55 徐岩 阅读(155) 评论(0) 推荐(0)

摘要:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi 阅读全文

posted @ 2016-03-31 12:32 徐岩 阅读(150) 评论(0) 推荐(0)

摘要: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 阅读全文

posted @ 2016-03-31 10:55 徐岩 阅读(137) 评论(0) 推荐(0)

摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Example1: x = 123, return 321Example2: x = -123, return -32 阅读全文

posted @ 2016-03-31 10:23 徐岩 阅读(103) 评论(0) 推荐(0)

摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo 阅读全文

posted @ 2016-03-30 14:45 徐岩 阅读(100) 评论(0) 推荐(0)

摘要: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 阅读全文

posted @ 2016-03-30 14:00 徐岩 阅读(121) 评论(0) 推荐(0)

摘要: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 ex 阅读全文

posted @ 2016-03-29 22:52 徐岩 阅读(149) 评论(0) 推荐(0)