Тёмный

ARRAY PRACTICE PROBLEMS | Must do Array Questions | DSA Problems | GeeksforGeeks 

GeeksforGeeks
Подписаться 815 тыс.
Просмотров 31 тыс.
50% 1

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

 

23 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 17   
@GeeksforGeeksVideos
@GeeksforGeeksVideos 10 месяцев назад
🔴 What is Queue? Watch Now!: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-J7EhXvnixRM.htmlsi=Swnh_wOAgvdRVXmX 🔴 Check out the Full DSA Course: ru-vid.com/group/PLqM7alHXFySHWUSBXUW9eq-ajb2JLoFNS&si=m_4B8bdS8dSJ9W6m
@jithendhar8817
@jithendhar8817 Год назад
Hey sir, if possible, try to explain implementation of recursion problems with more than 2 recursion calls & explain how to build logic in the first place to write such recursion functions.
@GeeksforGeeksVideos
@GeeksforGeeksVideos Год назад
Thank you for the suggestion. We will definitely try to make a video on the same. Till then, you can search for the same on: www.geeksforgeeks.org/
@misy_code
@misy_code 5 месяцев назад
Leaders in an array:- brute force approach:- my_array = list(map(int, input("Enter comma seperated values").split(","))) n = len(my_array) ans = [] for i in range(n): leader = True for j in range(i+1, n): if my_array[j] > my_array[i]: leader = False if leader == True: ans.append(my_array[i]) print(ans) optimal approach:- my_array = list(map(int, input("Enter comma separated values").split(","))) n = len(my_array) ans = [] maxi = 0 for i in reversed(range(n)): if my_array[i] >= maxi: ans.append(my_array[i]) maxi = max(my_array[i], maxi) ans.reverse() print(ans)
@pritamdavis
@pritamdavis 3 месяца назад
nice
@AnjaneyuluGadelaRamanjaneyulu
@AnjaneyuluGadelaRamanjaneyulu 5 месяцев назад
Sir where is the code of the problems ur just explaining
@pritamdavis
@pritamdavis 3 месяца назад
In the 3rd problem we use an hashmap?
@GeeksforGeeksVideos
@GeeksforGeeksVideos Год назад
Suggest some more practice question here!
@misy_code
@misy_code 5 месяцев назад
Sort an array of 0s 1s 2a using DNF Algorithm my_array = list(map(int, input("Enter space separated elements with 0s 1s 2s").split())) n = len(my_array) low = 0 mid = 0 high = n-1 while mid
@akshatakorgaonkar7379
@akshatakorgaonkar7379 7 месяцев назад
where can i find solution to these problems?
@Ringtone4youu
@Ringtone4youu 7 месяцев назад
public static void main (String [] args){ int [] arr={16, 17, 4, 3, 5, 2}; int n= arr.length; int max= arr[n-1]; System.out.println("Leader of the array is "+ max); for(int i=n-2;i>=0; i--){ if(arr[i]>max){ max= arr[i]; System.out.println("Leaders of the array "+ max); } } }
@akshatakorgaonkar7379
@akshatakorgaonkar7379 6 месяцев назад
thanks@@Ringtone4youu
@roshanbhaskar9804
@roshanbhaskar9804 2 месяца назад
lst=[] for i in range(0,6): x=int(input(" ")) lst.append(x) max_of_array=lst[-1] print(max_of_array) for j in range(len(lst)-2,0,-1): if lst[j]>max_of_array: print(lst[j]) max_of_array=lst[j] i think this is question 1 answer
@TanmayJain-f9y
@TanmayJain-f9y 3 дня назад
@GeeksforGeeksVideos Count More than n/k Occurrences Solutions # APPROACH-1: Time Complexity = O(n), Space Complexity = O(n) def countNByKOccurences(k, array = []): mapOfElementOccurrences = {} temp = {} result = 0 for i in range(len(array)): if mapOfElementOccurrences.get(array[i]) is not None: mapOfElementOccurrences[array[i]] += 1 else: mapOfElementOccurrences[array[i]] = 1 if mapOfElementOccurrences[array[i]] > (len(array) // k): if temp.get(array[i]) is None: temp[array[i]] = True result += 1 return result # APPROACH-2: Time Complexity = O(n), Space Complexity = O(m) where m is number of majority elements in the array; # m is always less than n. def countNByKOccurences(k, array = []): mapOfElementOccurrences = {} result = 0 for i in range(len(array)): if mapOfElementOccurrences.get(array[i]) is not None: mapOfElementOccurrences[array[i]] += 1 else: mapOfElementOccurrences[array[i]] = 1 for count in mapOfElementOccurrences.values(): if count > (len(array) // 2): result += 1 return result Sir, do you think these two approaches are optimal ?
@r.kgamer5501
@r.kgamer5501 Год назад
Bhai hacking so jata hai
@vandnajaiswal3254
@vandnajaiswal3254 5 месяцев назад
Bakwaas
@misy_code
@misy_code 5 месяцев назад
@vandnajaiswal3254 If you can't speak well then don't speak anything at all. You don't know how much courage, practice, and hard work it takes to become a mentor in geeks for geeks. If you cannot encourage something good out there, stay quiet and don't speak badly.
Далее
Handsoms😍💕
00:15
Просмотров 7 млн
LeetCode was HARD until I Learned these 15 Patterns
13:00
Best Books for Learning Data Structures and Algorithms
14:01
8 patterns to solve 80% Leetcode problems
7:30
Просмотров 404 тыс.
How I Mastered Data Structures and Algorithms
10:45
Просмотров 220 тыс.