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 | 222 Views, 24072 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 | 222 Views, 24072 Search Bots | 58 Words Subscribe to Feed Burner

Related Articles

  1. Patterns for breaking down questions you haven
  2. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  3. Daily Interview Problem: Reverse Integer
  4. Daily Interview Problem: Minimum Removals for Valid Parenthesis
  5. Binary Tree Level with Minimum Sum
  6. Progess made
  7. [Daily Problem] Add two numbers as a linked list
  8. Delphi Dynamic Array
  9. Print a tree level-by-level, with line-breaks
  10. Fibonacci coding

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />