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

Related Articles

  1. Daily Interview Question: Create a Simple Calculator
  2. Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
  3. Design Tic-Tac-Toe
  4. Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
  5. Find Missing Numbers in an Array
  6. Binary Tree Level with Minimum Sum
  7. Delphi Dynamic Array
  8. Fibonacci coding
  9. Daily Interview Problem: Reverse Words in a String
  10. Plus One

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