To the Top
File:  root - text - article - 2019 - 10 - longest-sequence-with-two-unique-numbers.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 238 Views, 15078 Search Bots | 54 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Facebook:

Given a sequence of numbers, find the longest sequence that contains only 2 unique numbers.

Example:
Input: [1, 3, 5, 3, 1, 3, 1, 5]
Output: 4
The longest sequence that contains just 2 unique numbers is [3, 1, 3, 1]

Here's the solution signature:


def findSequence(seq):
# Fill this in.

print findSequence([1, 3, 5, 3, 1, 3, 1, 5])
# 4
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 238 Views, 15078 Search Bots | 54 Words Subscribe to Feed Burner

Related Articles

  1. Algorithm Interview Question: H-Index
  2. Daily Interview Problem: Product of Array Except Self
  3. [Daily Problem] Move Zeros
  4. [Daily Problem] Add two numbers as a linked list
  5. A trick for getting good at coding interviews FASTER
  6. Algorithm Interview: Make the Largest Number
  7. Most Frequent Subtree Sum
  8. Algorithm Interview: Convert Roman Numerals to Decimal
  9. Binary Tree Level with Minimum Sum
  10. Progess made

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" />