File: root - text - article - 2020 - 02 - find-missing-numbers-in-an-array.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 464 Views, 23237 Search Bots | 84 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 464 Views, 23237 Search Bots | 84 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Twitter:
Given an array of integers of size n, where all elements are between 1 and n inclusive, find all of the elements of [1, n] that do not appear in the array. Some numbers may appear more than once.
Example:
Input: [4,5,2,6,8,2,1,5]
Output: [3,7]
For this problem, you can assume that you can mutate the input array.
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 464 Views, 23237 Search Bots | 84 Words Given an array of integers of size n, where all elements are between 1 and n inclusive, find all of the elements of [1, n] that do not appear in the array. Some numbers may appear more than once.
Example:
Input: [4,5,2,6,8,2,1,5]
Output: [3,7]
class Solution(object):
def findDisappearedNumbers(self, nums):
# Fill this in.
nums = [4, 6, 2, 6, 7, 2, 1]
print(Solution().findDisappearedNumbers(nums))
# [3, 5]
For this problem, you can assume that you can mutate the input array.
Related Articles
- Staying on a Chess Board
- Sorting a list with 3 unique numbers
- Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Algorithm Interview: Permutations of numbers
- Progess made
- Daily Interview Problem: Reverse Words in a String
- Daily Interview Problem: Full Binary Tree
- Compare Version Numbers
- Fix Brackets
©2006~2024 SteakOverCooked - 0.00872 Seconds(s) - 6188.332 KB/s - 45 Online Memory: 516.21 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 !