To the Top
File:  root - text - article - 2020 - 01 - max-and-min-with-limited-comparisons.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 169 Views, 22073 Search Bots | 58 Words

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

Given a list of numbers of size n, where n is greater than 3, find the maximum and minimum of the list using less than 2 * (n - 1) comparisons.

Here's a start:


def find_min_max(nums):
# Fill this in.

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

Related Articles

  1. Daily Interview Puzzle: Ways to Traverse a Grid
  2. Batch Programming in XP
  3. Consecutive Ones
  4. Daily Interview Problem: Arithmetic Binary Tree
  5. Daily Interview Puzzle: Minimum Size Subarray Sum
  6. Daily Interview Question: Create a Simple Calculator
  7. [Daily Problem] Remove k-th Last Element From Linked List
  8. Staying on a Chess Board
  9. Daily Interview Problem: Group Words that are Anagrams
  10. [Daily Problem] Longest Palindromic Substring

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