Тёмный

1122. Relative Sort Array | sorting | leetcode daily challenge | DSA | shashwat tiwari | Hindi 

shashCode
Подписаться 16 тыс.
Просмотров 1,4 тыс.
50% 1

Problem Name:
1122. Relative Sort Array
Problem Statement:
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.
Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that do not appear in arr2 should be placed at the end of arr1 in ascending order.
Problem link:
leetcode.com/problems/relativ...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.com/spreadsheets/...
Notes:
github.com/Tiwarishashwat/Jav...
Telegram Link:
shashwattiwari.page.link/tele...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shas...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding​​ #problemsolving​

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

 

9 июн 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 6   
@RohitKumar-dz8dh
@RohitKumar-dz8dh Месяц назад
Thanks 😊
@dibakarbera1971
@dibakarbera1971 Месяц назад
excellent explanation sir
@thenikhildaiya.
@thenikhildaiya. Месяц назад
Mene aapki kal ki leetcode daily problem waali video se counting sort wala solution dekha. And aaj waali problem se relate kar paya and solved it on my own😊 And my approach and solution were almost same as yours. Thank You!
@mr.nishantawasthi4402
@mr.nishantawasthi4402 Месяц назад
Sir ab to bata dijiye ki tree series k baad kya padhne wale hai please 🙏
@ankitraj4179
@ankitraj4179 Месяц назад
Java Code : class Solution { public int[] relativeSortArray(int[] arr1, int[] arr2) { int n1 = arr1.length ; int n2 = arr2.length ; Arrays.sort(arr1) ; HashMap map = new HashMap() ; for(int i = 0 ; i 0) { arr1[k] = key; k++; count--; } } return arr1 ; } }
@ankitraj4179
@ankitraj4179 Месяц назад
Java Code (Optimized) class Solution { public int[] relativeSortArray(int[] arr1, int[] arr2) { int n1 = arr1.length , n2 = arr2.length ; int Max = Integer.MIN_VALUE ; for(int i = 0 ; i< n1 ; i++){ Max = Math.max(Max,arr1[i]) ; } int[] count = new int[Max+1] ; for(int i = 0 ; i
Далее
How I would learn Leetcode if I could start over
18:03
Просмотров 383 тыс.
How to Start Leetcode (as a beginner)
8:45
Просмотров 766 тыс.
Pointers and dynamic memory - stack vs heap
17:26
Просмотров 1,4 млн
Relative Sort Array - Leetcode 1122 - Python
7:32
Просмотров 9 тыс.