Finding a number that repeats even no of times where all the other numbers repeat odd no of times
2012-07-26 12:41
381 查看
看Careercup上一个美国女人问的
阿三哥们讨论半天 还是没有时间O(n)和空间O(1)的解法
时间O(n)最好的方法就是哈希方法,最后判断奇偶时候用x^0x01判断
空间O(1)的方法就是快速排序了
看他们讨论了半天 真是欢快
阿三哥们讨论半天 还是没有时间O(n)和空间O(1)的解法
时间O(n)最好的方法就是哈希方法,最后判断奇偶时候用x^0x01判断
空间O(1)的方法就是快速排序了
看他们讨论了半天 真是欢快
相关文章推荐
- Given constant integers x and t, write a function that takes no argument and returns true if the function has been called x number of times in last t secs.
- CareerCup Fill the array with product of all numbers except the number in that cell
- [LinkedIn] Array of products of all other numbers (except/without the current number ) (no division)
- Find the Number Occurring Odd Number of Times
- Given an array of numbers, return array of products of all other numbers (no division)
- Failed to sign bin\Debug\app.publish\setup.exe. SignTool Error: No certificates were found that met all of the given criteria.
- Data Structure Array: Given an array of of size n and a number k, find all elements that appear more than n/k times
- Find the number of subsets such that the sum of numbers in the subset is a prime number
- Repeat Part of the Regex a Certain Number of Times (重复匹配中的部分)
- Algorithm: Make all the odd numbers precede all the even numbers in an array.
- Algorithm: Make all the odd numbers precede all the even numbers in an array.
- *Find the Number Occurring Odd Number of Times
- Find the Number Occurring Odd Number of Times
- Write a Servlet Application that uses a cookie to track the number of times a user visits a web site
- the Maven Integration requires that Eclipse be runing in a JDK,because a number of Maven core plugin
- hdu 1492 The number of divisors(约数) about Humble Numbers (数学:排列组合)
- The DBMS that DB Query Analyzer users often access nearly covers all kinds of DBMS
- find the smallest subtree that contains all of the tree's deepest nodes
- [计算最大公因子]Finding the greatest common divisor (gcd) of 2 numbers
- HDU 1492 The number of divisors(约数) about Humble Numbers(数学题)