How to Generate subarrays using recursion
[Question]: We haveGiven an array, generate all the possible subarrays of the given array using recursion for example :
How to Generate subarrays using recursion Read More »
[Question]: We haveGiven an array, generate all the possible subarrays of the given array using recursion for example :
How to Generate subarrays using recursion Read More »
[Question ] Check weather array is palindrome Example : [1,2,2,1] ===> It’s palindrome Solution#: Here we are checking first & last element equality & increase till mid of array
How to check if array is Palindrome ? Read More »
[Question] : Reverse array using recursion Example: [1,2,3] = [3,2,1]. Approach #1 using two variables : – // Approach#2: Using single pointer/variable so we written base case which blocks on n/2, we are just increasing the element by +1 on every recursion till half of the array.
How to reverse an array using recursion ? Read More »
# Question 1: Find sum of first n numbers. Example :– n = 3 => 3+2+1 =6. We will use recursion to solve this problem. # Question 2: Find sum of array elements using recursion approach :
How to find sum of first N numbers in swift ? Read More »
So here we have used recursion The names which is before function will print FIFO & vice versa
How to print n times using recursion Read More »
[Question]: Check if the given string has balanced parenthesis //Example 1: // //Input: s = “()” //Output: true //Example 2: // //Input: s = “[](){}” //Output: true //Example 3: // //Input: s = “(}” //Output: false
How to check balanced Parenthesis in swift ? Read More »
We will create a stack where we perform push, pop and other operations. Here we have covered question – Print Reverse Stacks More can be find here 2. Check Balance Parentheses.
How to create Stack in Swift ? Read More »
[Question] In a given array return true if array have duplicate elements . For example 1 :[1,2,3,1] = True example 1 :[1,2,3,] = False So here we have used Dictionary which is Hashable which contains only unique keys hence we can find duplicates elements in swift.
How to find duplicates in Array? Read More »
For setting up n number of lines of Text in swiftUI we can use .lineLimit(.. function which takes arguments as number of lines. #For iOS 15 & Below : we have to set .fixedSize(horizontal: false, vertical: true) & .lineLimit(2) # For iOS 16 onwards
How to set two line text in SwiftUI ? Read More »
[Question] Find Maximum and minimum of an array in swift using minimum number of comparisons #Approach: 1 Use first element as min max & start loop from second element onwards & return tuple of the min max number
How to Find Min Max in Array Read More »