随笔分类 -  leetcode算法笔记

欢迎各位同仁赐教!
摘要:Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum 阅读全文
posted @ 2016-07-28 10:05 Roger's 阅读(157) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2016-07-20 13:47 Roger's 阅读(171) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. 题目:升级版找两个数组的交集,初级 阅读全文
posted @ 2016-07-20 13:30 Roger's 阅读(113) 评论(0) 推荐(0)
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2016-07-20 13:25 Roger's 阅读(186) 评论(0) 推荐(0)
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2016-07-20 11:29 Roger's 阅读(173) 评论(0) 推荐(0)
摘要:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: pu 阅读全文
posted @ 2016-07-20 11:09 Roger's 阅读(170) 评论(0) 推荐(0)
摘要: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 = 阅读全文
posted @ 2016-07-20 11:04 Roger's 阅读(153) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. 题目:意思很简单就是,找出数组中出现规 阅读全文
posted @ 2016-07-20 10:33 Roger's 阅读(196) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2016-07-20 10:28 Roger's 阅读(117) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2016-07-20 10:16 Roger's 阅读(159) 评论(0) 推荐(0)
摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2016-07-20 10:07 Roger's 阅读(155) 评论(0) 推荐(0)
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2016-07-20 09:29 Roger's 阅读(148) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文
posted @ 2016-07-15 17:45 Roger's 阅读(112) 评论(0) 推荐(0)
摘要:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2016-07-15 17:05 Roger's 阅读(141) 评论(0) 推荐(0)
摘要: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 representation and r 阅读全文
posted @ 2016-07-15 13:23 Roger's 阅读(202) 评论(0) 推荐(0)
摘要:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.For example, public String numbe 阅读全文
posted @ 2016-07-14 17:42 Roger's 阅读(282) 评论(0) 推荐(0)
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2016-07-14 14:39 Roger's 阅读(166) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题目:给你丫一字符串,你给我倒着写。。。。 思路:我一开 阅读全文
posted @ 2016-07-14 14:20 Roger's 阅读(147) 评论(0) 推荐(0)
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2016-07-14 14:08 Roger's 阅读(103) 评论(0) 推荐(0)
摘要:Invert a binary tree. to /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(i 阅读全文
posted @ 2016-07-14 13:54 Roger's 阅读(155) 评论(0) 推荐(0)