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 reverse an Integer ?

Leave a Comment / Array-Strings, DSA

[Question]: Reverse Integer in swift ex. 12345 => 54321 output should lie in Int32 Range TC: O(n)SC: O(1) Explanation: Here we are multiplying result with10 further adding it to modulo(reminder) & get last element by divide by 10 Example – 7913 ==== 3197 r 0 30 310 3190 r 3 31 319 3197 x 791 […]

How to reverse an Integer ? Read More »

How to find maximum sum of a subarray of size k – Sliding window swift

Leave a Comment / Array-Strings, DSA

[Question]: Find maximum sum of a subarray of size k example [9,1,3,2,6,1,5,9], k: 4 = output: 21 (6+1+5+9)Solution: with sliding window we can achieve. first we take sum of first k elements further move elements by 1 window size & add the latest var & remove last var.

How to find maximum sum of a subarray of size k – Sliding window swift Read More »

How to add two numbers in LinkList ?

Leave a Comment / DSA, LinkedList

[Question]: – Add two numbers using the ListList in swift. Ex Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: 342 + 465 = 807. Explanation: # Recursion Approach: Create a sum variable & add two nodes with a previous reminder on the recursive call use modulo operator to use the numerator value (7%10

How to add two numbers in LinkList ? Read More »

Return all possible subset from an array

Leave a Comment / Array-Strings, Recursion

[Question]: Given an integer array that may contain duplicates, find all possible subsets (the power set). No duplicates allowed in answer. Solution in any order allowed. Input: nums = [1,2,3] Output: [1,2,3] [1,2] [1,3] [1] [2,3] [2] [3] [] Approach #2: Using Bitwise OperatorQuestion: Power Set: Print all the possible subsequences of the String To check

Return all possible subset from an array Read More »

How to find subset sum

Leave a Comment / DSA, Recursion

[Question] : Find subset sum in given ArrayExample: Input: N = 6 arr[] = {3, 34, 4, 12, 5, 2} sum = 9 Output: 1 Explanation: Here there exists a subset with sum = 9, 4+3+2 = 9.

How to find subset sum Read More »

Find combination of sum possibilities

Leave a Comment / DSA, Recursion

[Question]: In a distinct array a target integer target, return a list of all unique combinations of  candidateInput: candidates = [2,3,6,7], target = 7 Output: [[2,2,3],[7]]

Find combination of sum possibilities Read More »

Count All Possible Sequence whose sum is K

Leave a Comment / DSA, Recursion

[Question]: In an array count all possible sequence whose sum is K. example:- [4,8,4] Target Sum = 8 So Output will be 2 because sequences are: [4,4] [8]

Count All Possible Sequence whose sum is K Read More »

Print one sequence whose sum is K

Leave a Comment / DSA, Recursion

[Question] : Print any one sequence whose some is equal to KFor example:- [4,8,4] Target Sum = 8 So Output will be [4,4]

Print one sequence whose sum is K Read More »

How to Find all subsequences with sum equals to K

Leave a Comment / DSA, Recursion

[Question] : In a given array find all possible sequence whose sum is certain number: For example:- [4,8,4] Target Sum = 8 So Output will be [4,4] [8]

How to Find all subsequences with sum equals to K Read More »

Multilevel recursion in swift

Leave a Comment / DSA, Recursion

Here we will discuss two level recursion in swift. If there is statement before the recursive function it will print in sequence & vice versa. Here is example code with print statement –

Multilevel recursion in swift Read More »

Post pagination
← Previous 1 … 12 13 14 … 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