File: root - text - article - 2019 - 10 - find-the-non-duplicate-number.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 532 Views, 22071 Search Bots | 60 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 532 Views, 22071 Search Bots | 60 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Facebook:
Given a list of numbers, where every number shows up twice except for one number, find that one number.
Example:
Input: [4, 3, 2, 4, 1, 3, 2]
Output: 1
Here's the function signature:
Challenge: Find a way to do this using O(1) memory.
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 532 Views, 22071 Search Bots | 60 Words Given a list of numbers, where every number shows up twice except for one number, find that one number.
Example:
Input: [4, 3, 2, 4, 1, 3, 2]
Output: 1
Here's the function signature:
def singleNumber(nums):
# Fill this in.
print singleNumber([4, 3, 2, 4, 1, 3, 2])
# 1
Challenge: Find a way to do this using O(1) memory.
Related Articles
- Algorithm Interview: String Compression
- Floor and Ceiling of a Binary Search Tree
- Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
- [Daily Problem] Course Prerequisites
- Reverse a Linked List
- Most Frequent Subtree Sum
- Algorithm Interview Question: Find the Single Element in an Array of Duplicates
- Daily Interview Problem: Contiguous Subarray with Maximum Sum
- Print a tree level-by-level, with line-breaks
- CVE-2015-8874 - cPanel EasyApache Vulnerabilities
©2006~2024 SteakOverCooked - 0.00781 Seconds(s) - 2530.088 KB/s - 24 Online Memory: 493.04 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !