To the Top
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 | 159 Views, 18294 Search Bots | 84 Words

Subscribe to Feed Burner | 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]

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.
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 159 Views, 18294 Search Bots | 84 Words Subscribe to Feed Burner

Related Articles

  1. Non-decreasing Array with Single Modification
  2. Daily Interview Puzzle: Intersection of Linked Lists
  3. Daily Interview Problem: Arithmetic Binary Tree
  4. Two-Sum
  5. Delphi Dynamic Array
  6. How to Play WAV music under DOS?
  7. Daily Interview Question: Edit Distance
  8. Daily Interview Problem: Contiguous Subarray with Maximum Sum
  9. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  10. [Daily Problem] Remove Consecutive Nodes that Sum to 0

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />