Skip to content
JaneshSwift.com
JaneshSwift
  • Home
  • Swift
  • SwiftUI
  • DSA
    • Array-Strings
    • BinarySearch
    • String
    • Math
    • Sorting
    • StacksQueues
    • LinkedList
    • Recursion
    • DynamicProgramming
  • Android
  • About us
JaneshSwift.com
JaneshSwift

How to Generate subarrays using recursion

Leave a Comment / DSA, 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 »

How to check if array is Palindrome ?

Leave a Comment / Array-Strings, DSA

[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 »

How to reverse an array using recursion ?

Leave a Comment / DSA, Recursion

[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 »

How to find sum of first N numbers in swift ?

Leave a Comment / Array-Strings, DSA

# 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 »

How to print n times using recursion

Leave a Comment / Recursion

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 »

How to check balanced Parenthesis in swift ?

Leave a Comment / DSA

[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 »

How to create Stack in Swift ?

Leave a Comment / DSA

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 »

How to find duplicates in Array?

Leave a Comment / Array-Strings, DSA

[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 »

How to set two line text in SwiftUI ?

Leave a Comment / iOS, SwiftUI

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 »

How to Find Min Max in Array

Leave a Comment / Array-Strings, DSA

[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 »

Post pagination
← Previous 1 … 13 14 15 … 18 Next →
  • Home
  • Swift
  • SwiftUI
  • DSA
    • Array-Strings
    • BinarySearch
    • String
    • Math
    • Sorting
    • StacksQueues
    • LinkedList
    • Recursion
    • DynamicProgramming
  • Android
  • About us
Search
Search

Copyright © 2025 JaneshSwift | Powered by JaneshSwift

  • Privacy Policy
  • Terms & Conditions
  • About us
  • Contact us
  • Sitemap