随笔分类 -  Algorithm

上一页 1 2 3 4 5 6 ··· 16 下一页
classic algorithm, problem
摘要:Follow up for H Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Hint:Expected runtime complexity... 阅读全文
posted @ 2015-09-09 15:55 卖程序的小歪 阅读(105) 评论(0) 推荐(0)
摘要:Given an array of citations (each citation is a non negative integer) of a researcher, write a function to compute the researcher's h index. Accordin... 阅读全文
posted @ 2015-09-09 15:36 卖程序的小歪 阅读(158) 评论(0) 推荐(0)
摘要:>Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa... 阅读全文
posted @ 2015-08-29 21:35 卖程序的小歪 阅读(126) 评论(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 @ 2015-08-29 16:54 卖程序的小歪 阅读(131) 评论(0) 推荐(0)
摘要:>Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. T... 阅读全文
posted @ 2015-08-09 12:40 卖程序的小歪 阅读(162) 评论(0) 推荐(0)
摘要:>Write a SQL query to find all duplicate emails in a table named Person.```+----+---------+| Id | Email |+----+---------+| 1 | a@b.com || 2 | c@d.... 阅读全文
posted @ 2015-08-03 22:42 卖程序的小歪 阅读(128) 评论(0) 推荐(0)
摘要:>The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id.```+----+-------+-------... 阅读全文
posted @ 2015-08-03 22:22 卖程序的小歪 阅读(147) 评论(0) 推荐(0)
摘要:>Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.```+----+-------... 阅读全文
posted @ 2015-08-03 22:06 卖程序的小歪 阅读(168) 评论(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 @ 2015-08-03 21:12 卖程序的小歪 阅读(144) 评论(0) 推荐(0)
摘要:>Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:>Integers in each row are sorted ... 阅读全文
posted @ 2015-07-23 11:15 卖程序的小歪 阅读(128) 评论(0) 推荐(0)
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k nu... 阅读全文
posted @ 2015-07-20 01:00 卖程序的小歪 阅读(186) 评论(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 @ 2015-07-17 00:32 卖程序的小歪 阅读(109) 评论(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 @ 2015-07-16 23:55 卖程序的小歪 阅读(124) 评论(0) 推荐(0)
摘要:>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 lowe... 阅读全文
posted @ 2015-07-13 20:17 卖程序的小歪 阅读(124) 评论(0) 推荐(0)
摘要:>Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.>For example:>Given n = 13,>Retu... 阅读全文
posted @ 2015-07-11 20:37 卖程序的小歪 阅读(185) 评论(0) 推荐(0)
摘要:>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?```/** * Definition for singly-li... 阅读全文
posted @ 2015-07-11 19:49 卖程序的小歪 阅读(220) 评论(0) 推荐(0)
摘要:>Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.>According to the definition of LCA on Wikipedi... 阅读全文
posted @ 2015-07-11 19:33 卖程序的小歪 阅读(148) 评论(0) 推荐(0)
摘要:>Reverse bits of a given 32 bits unsigned integer.>For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retu... 阅读全文
posted @ 2015-07-07 22:57 卖程序的小歪 阅读(141) 评论(0) 推荐(0)
摘要:>Implement the following operations of a queue using stacks.>push(x) -- Push element x to the back of queue.>pop() -- Removes the element from in fron... 阅读全文
posted @ 2015-07-07 20:56 卖程序的小歪 阅读(181) 评论(0) 推荐(0)
摘要:>Given a list of non negative integers, arrange them such that they form the largest number.>For example, given [3, 30, 34, 5, 9], the largest formed ... 阅读全文
posted @ 2015-07-06 21:47 卖程序的小歪 阅读(142) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 16 下一页