Akshima Sharmakeycomputereducation.hashnode.dev·May 6, 2024Minimize the Heights II - 450DSA Cracker SolutioMinimize the Heights II Given an array arr[] denoting heights of N towers and a positive integer K. For each tower, you must perform exactly one of the following operations exactly once. Increase the height of the tower by K Decrease the height of ...450 DSA SeriesProgramming Blogs
Akshima Sharmakeycomputereducation.hashnode.dev·May 5, 2024Kadane's Algorithm - 450DSA Cracker SolutionKadane's Algorithm Given an array Arr[] of N integers. Find the contiguous sub-array(containing at least one number) which has the maximum sum and return its sum. Example 1: Input: N = 5 Arr[] = {1,2,3,-2,5} Output: 9 Explanation: Max subarray sum is...450 DSA SeriesProgramming Blogs
Akshima Sharmakeycomputereducation.hashnode.dev·May 4, 2024Cyclically rotate an array by one - 450DSA Cracker SolutionCyclically rotate an array by one Given an array, rotate the array by one position in clock-wise direction. Example 1: Input: N = 5 A[] = {1, 2, 3, 4, 5} Output: 5 1 2 3 4 Example 2: Input: N = 8 A[] = {9, 8, 7, 6, 4, 2, 1, 3} Output: 3 9 8 7 6 4 ...450 DSA SeriesDSA
Akshima Sharmakeycomputereducation.hashnode.dev·May 2, 2024Move all negative elements to endMove all negative elements to end Given an unsorted array arr[] of size n having both negative and positive integers. The task is place all negative element at the end of array without changing the order of positive element and negative element. Exam...450 DSA Series450dsa, reverse string C++ , DSA ,data structures
Akshima Sharmakeycomputereducation.hashnode.dev·Feb 6, 2024Reverse the array - 450DSA Cracker SolutionReverse a String Given a String S , print the reverse of the string as output. class Solution { public: string revStr(string S) { for(int i = 0, j= S.length()-1; i<j ;i++,j--) { swap(S[i], S[j]); } re...20 likes450 DSA Series450dsa
Akshima Sharmakeycomputereducation.hashnode.dev·Feb 6, 2024Find the "Kth" max and min element of an array - 450DSA Cracker SolutionKth smallest element Given an array arr[] and an integer K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct. Note :- l and r denotes the starting...450 DSA SeriesProgramming Blogs
Akshima Sharmakeycomputereducation.hashnode.dev·Feb 6, 2024Find the maximum and minimum element in an array - 450DSA Cracker SolutionFind minimum and maximum element in an array Given an array A of size N of integers. Your task is to find the minimum and maximum elements in the array. Example 1: Input: N = 6 A[] = {3, 2, 1, 56, 10000, 167} Output: 1 10000 Explanation: minimum and ...450 DSA Series450dsa