Longest Subarray with Sum K #geeksforgeeks #geekslogic #coding #python #datastructure #developer

preview_player
Показать описание
Longest Subarray with Sum K #geeksforgeeks #geekslogic #coding #python #datastructure #developer

Union of 2 Sorted with Duplicates DSA problem Geeksforgeeks // gfg DSA problem Solution

Given two sorted arrays a[] and b[], where each array may contain duplicate elements , the task is to return the elements in the union of the two arrays in sorted order.

Union of two arrays can be defined as the set containing distinct common elements that are present in either of the arrays.

Input: a[] = [1, 2, 3, 4, 5], b[] = [1, 2, 3, 6, 7]
Output: 1 2 3 4 5 6 7
Explanation: Distinct elements including both the arrays are: 1 2 3 4 5 6 7.
Input: a[] = [2, 2, 3, 4, 5], b[] = [1, 1, 2, 3, 4]
Output: 1 2 3 4 5
Explanation: Distinct elements including both the arrays are: 1 2 3 4 5.
Input: a[] = [1, 1, 1, 1, 1], b[] = [2, 2, 2, 2, 2]
Output: 1 2
Explanation: Distinct elements including both the arrays are: 1 2.

Given a sorted array arr[] (with unique elements) and an integer k, find the index (0-based) of the largest element in arr[] that is less than or equal to k. This element is called the "floor" of k. If such an element does not exist, return -1.

Easy type DSA gfg problem // geeksforgeeks DSA Problem // #geeksforgeeks // Floor in a Sorted Array.

#geeksforgeeks #coding #geekslogic #programming #gfgalgorithms #gfgsolutions #developer #gfg #education #gfgsolutions #geekslogic #gfgsolutions #thecoder #gfgsolutions #excel #viralvideo #views #newcoding
Рекомендации по теме
visit shbcf.ru