Prefix, Infix and Postfix Conversions
Operator Priority and Expression Conversions Operators: +, -, *, /, ^ Operands: A-Z, a-z, 0-9 Decreasing Order of Priority : Assume the levels of priority - Operator P...
Operator Priority and Expression Conversions Operators: +, -, *, /, ^ Operands: A-Z, a-z, 0-9 Decreasing Order of Priority : Assume the levels of priority - Operator P...
📝 Note Subarray means contiguous part of the array For an example : arr[] = { 1, 2, 3, 4, 5, 6 } Here, Subarrays are { 1, 2, 3}, { 4, 5, 6 }, { 3, 4, 5 } But { 1, 2, 5}, { 2, 5, 6 }, { 1, 4, 5 ...
Given an array may contains positive and negative both elements and an integer K, we need to find the Longest Subarray with sum K. The code below is the optimal solution for this problem. Detailed...
📝 Note If we XOR the same numbers (a ^ a), the result is always 0. The maximum size of the array can be defined as (10^8) globally, and up to (10^7) inside the main function. Given an ...
Given an array arr[] = { 1, 1, 0, 1, 1, 1, 0, 1, 1 }, We need to find the length of the longest sequence of consecutive 1s. For example, in this case, the maximum consecutive ones are 3. Optimal A...
📝 Note If we XOR the same numbers (a ^ a), the result is always 0. Given an integer n = 5 and an array arr[] = { 1, 2, 4, 5 } of size n - 1, where the array contains elements ranging from 1...
📝 Note Whenever we need to work with unique elements, we should use a set or a map. A set ensures that only unique elements are stored and maintains them in sorted order. The term ‘Sorted ...
Given an array arr[] = { 6, 7, 8, 4, 1 } and num = 4, We need to find the first occurrence of num in the array. If num is found, return its index. Otherwise, return -1. Approach: The function ...
📝 Note The term ‘Sorted Array’ is very important, if we want to go for optimal solution. We are given two sorted arrays that may contain duplicate elements. We need to find their intersecti...
Given an array arr[] = { 1, 2, 3, 4, 5 }, we have to right rotate the array by one place. To rotate the array to the right by one position, we can directly modify the given array without using extr...