Тёмный

Permuting Two Arrays - Hackerrank Problem 

Coding as a hobby
Подписаться 8
Просмотров 2,2 тыс.
50% 1

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

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 5   
@ayushyasidhnath788
@ayushyasidhnath788 Год назад
I was searching for the explanation of the challenge not just to read line by line.
@faithfulservant1380
@faithfulservant1380 2 года назад
Nice one
@faithfulservant1380
@faithfulservant1380 2 года назад
My question is why was A[0] compared to B[1] at 4:00. I am confused because I thought the question asked for a comparison of matching indices
@colebright2818
@colebright2818 2 года назад
It took me a while to understand, but what the question is asking is for you to arrange the array so that matching indices are greater than or equal to k. So the trick is to sort them both, reverse one of the arrays so then you can just compare A[i] to B[i]. Logically, that would be the only configuration that they would come together and match that condition. Then, if even one of those indices doesn't fit the condition, it returns NO. Sorry if this is all obvious to you.
@codingasahobby756
@codingasahobby756 2 года назад
That was a mistake on my part. I should've said A[0] B[0] not A[0] B[1]. Glad you caught that. Ill make a note of it and reshoot it. I've been building a backlog of hackerrank and leetcode problems and will be posting them on my main channel ru-vid.com/show-UCHaQP7nzYZ8Q-fhXZhqwV5w soon
Далее
Subarray division
33:17
Просмотров 2,8 тыс.
Flipping the Matrix : Solution to Hackerrank Challenge
10:33
Brawl Stars expliquez ça
00:11
Просмотров 6 млн
Array Manipulation | HackerRank
11:40
Просмотров 3,8 тыс.
HackerRank: Permuting Two Arrays
6:52
Просмотров 151
Go Has Exceptions??
16:58
Просмотров 73 тыс.
Sherlock and array
22:40
Просмотров 1,3 тыс.