Aditya Chatterjee's Blog, page 171
May 6, 2021
Building programmatic UI using Swift

Hello everyone in this article we are going to create a simple login page UI in iOS application using swift codein UIKit without using storyboard(visual designer).
What is StoryBoard in iOS developmentStoryboard is a visual designer which is used to design User Interface for apple devices.It has a drag and drop feature to design the User Interface.It comes along with Xcode.Before iOS 7 version Xcode the story board was a seperate software but now it is bundled with Xcode.
Advantages of using S...April 28, 2021
Upgrade Insecure Requests
Migrating to HTTPS, Mixed content, Content Security Policy
April 26, 2021
Find length of the longest Fibonacci subsequence
The objective of this article is to discuss various approaches to solve the length of the longest Fibonacci subsequence problem. In this problem, we have a strictly increasing array of positive integers. Our task is to find the length of the longest Fibonacci subsequence possible. We will solve this using Brute force and Dynamic Programming.
For example:
Input: arr = [1,2,3,4,5,6,7,8]Output: 5Explanation: The longest fibonacci subsequence is [1,2,3,5,8].Input: arr = [1,3,7,11,12,14,18]Outpu...Next Larger/ Smaller element (using Monotonic Queue)
In this article, we are going to discuss the various approaches to solve the Next Larger/ Smaller element problem. In this problem, we are given an array and our task is to find the next larger/ smaller element for each element in the array. If there is no larger/ smaller element to the right then return -1.
For example:
Array -> 8 5 2 3 9.Next larger element -> 9 9 3 9 -1.Next smaller element -> 5 2 -1 -1 -1.Array -> 18 25 2 13 29.Next larger element -> 25 29 13 29 -1.Next smaller ele...April 24, 2021
Minimum number of operations to convert binary string to self-destructing
We will explore algorithms to find the Minimum number of operations to convert a binary string to a self-destructing string.
What is a self-destructing string?
A binary string is called a self-destructing string if it can reduced to an empty string by performing the following operation 0 or more times:
"Choose a valid integer i such that the i-th character of the current string is different from the i 1-th character, and remove these two characters from the string."
The Problem
Given a binary st...
April 23, 2021
JSON Parsing in iOS using Swift

Hello everyone in this article we are going to see how to parse a JSON response from Web API in iOS app using Swift Codable Protocol.
What is JSON
JSON stands for JavaScript Object Notation.It is an open source data interchange format. It uses human readable text to store and send data. It stores the data in key value pair similar to a Dictionary data structure.
What we are going to build
We are going to build an iOS app which uses Quotes API (type.fit/api/quotes) which returns around 1000 quote...
Basics of stable matching
Given a graph G(V,E), a matching is a subgraph in G if each vertex has a degree one. No edge shares a vertex with another edge.
Size of a matchingSize of a matching is equal is to the number of edges present in the matching.
Perfect MatchingA matching is called perfect if it contains all the vertices present in the graph. Perfect matching is also known as Complete matching.
Bipartite graphsA bipartite graph is a graph whose vertices can be divided into
two disjo...
Implementing Priority Queue using Linked List
A queue is a FIFO data structure i.e First In First Out.
Priority queue as the name suggests should have the elements or tasks ordered with respect to priority in the queue.If two elements have the same priority than they
will be executed in the sequence they are added in the list.
The main operations for implementing a priority queue are:
PUSH(HEAD,DATA,PRIORITY):
Step 1:...Bit header file in C++20
The header was included in C++20.
IntroductionThe header was included in the C++20. This header provides components such as types and functions to access, manipulate and process individual bits and bit sequences. It is included in the library.
Binary representationBinary representation uses 0's and 1's to represent values. For example an integer 52 is represented as 110100.
knowing the binary representation can be very useful. Certain properties of binary representation have many applicatio...
System design of an URL Shortener (TinyURL or Bit.ly)
You might have seen URL shortener services such as TinyURL or Bit.ly which are used for using a short alias instead of long URLs. Even wondered why and how these kinds of applications work? In this article, we'll be discussing the system design of a URL shortener and compare it with some applications currently in use.
Before reading this article, it is suggested if you could go and try out tinyurl.com so that you could understand this article better.
What is the need of using this?Why do we nee...