File: root - text - article - 2019 - 12 - min-range-needed-to-sort.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 646 Views, 19904 Search Bots | 70 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 646 Views, 19904 Search Bots | 70 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Twitter:
Given a list of integers, return the bounds of the minimum range that must be sorted so that the whole list would be sorted.
Example:
Input: [1, 7, 9, 5, 7, 8, 10]
Output: (1, 5)
Explanation:
The numbers between index 1 and 5 are out of order and need to be sorted.
Here's your starting point:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 646 Views, 19904 Search Bots | 70 Words Given a list of integers, return the bounds of the minimum range that must be sorted so that the whole list would be sorted.
Example:
Input: [1, 7, 9, 5, 7, 8, 10]
Output: (1, 5)
Explanation:
The numbers between index 1 and 5 are out of order and need to be sorted.
Here's your starting point:
def findRange(nums):
# Fill this in.
print findRange([1, 7, 9, 5, 7, 8, 10])
# (1, 5)
Related Articles
- Daily Interview Puzzle: Falling Dominoes
- Daily Interview Problem: Look and Say Sequence
- Spreadsheet Columns
- Daily Interview Problem: Room scheduling
- Algorithm Interview: Permutations of numbers
- Daily Interview Problem: Find the k-th Largest Element in a List
- Daily Interview Question: Create a Simple Calculator
- Floor and Ceiling of a Binary Search Tree
- Daily Interview Problem: Min Range Needed to Sort
- Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
©2006~2024 SteakOverCooked - 0.01421 Seconds(s) - 1378.79 KB/s - 36 Online Memory: 492.87 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !