Тёмный

Breaking Down the Cyclic Sort Interview Pattern with Javascript - Part 3 of 3 

Coderbyte
Подписаться 26 тыс.
Просмотров 1,2 тыс.
50% 1

This is the third and last video on the cyclic sort interview pattern.
Watch part 1 here: • Cracking the Cyclic So...
This pattern is best used for problems involving arrays containing numbers in a given range. Using this pattern we can do things such as determining what order the numbers should be in, missing numbers, and duplicate numbers all with maximum linear time complexity aka O(n).
The Challenge (Hard Difficulty):
Given an unsorted array containing both positive and negative numbers, find the smallest missing positive number in it. You should do this in-place with a max time complexity of O(n).
Video Overview:
0:28 Cyclic sort overview
2:12 Problem
3:25 Approach
6:58 Javascript solution
18:12 Recap
Join us next week for part 3 of this pattern where we’ll walk through a more challenging problem.
Please subscribe to our channel :)
Additional Resources:
* Practice hundreds of real coding challenges at coderbyte.com/
* Check out our tiktoks @coderbyte

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 5   
@Zoronoa01
@Zoronoa01 2 года назад
hello please, can you do the remaining patterns? thank you
@kishoregarapati1
@kishoregarapati1 2 года назад
Thank you so much for covering each topic in detail. You explanation and code are very clean. Could also cover greedy algorithms on arrays.
@zm690
@zm690 2 года назад
I really love your teaching
@amorfati4559
@amorfati4559 Год назад
Sorry if this is an obvious question, but you said cyclic sort deals with ranges of numbers, and all of the question are ranges of numbers starting either at 0 or 1. So would there be a way to implement cyclic sort given other ranges, like starting at 7 or something without going over O(N) time and not knowing what the range is? Or are we just assuming that the range always starts at 0 or 1?
@mert_dikmen
@mert_dikmen 9 месяцев назад
If the range starts from some number k, then the correct position for the num[i] would be nums[i] - k. Just like subtracting 1 for the case that starts at 1.
Далее
Учёные из Тринидад и Тобаго
00:23
Negative Time is Real, Physicists Confirm. Kind Of.
6:59
How to Land Your Dream Tech Job
24:39
Просмотров 772
How to Traverse Binary Trees with Queues in Javascript
28:11