Aditya Chatterjee's Blog, page 171

May 6, 2021

Building programmatic UI using Swift

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 development

Storyboard 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...
 •  0 comments  •  flag
Share on Twitter
Published on May 06, 2021 09:24

April 28, 2021

Upgrade Insecure Requests

Migrating to HTTPS, Mixed content, Content Security Policy

unknown--1-

What is Upgrade Insecure Requests?The “upgrade-insecure-requests” Content Security Policy header instructing your browser request web stuff and do it with HTTPS and not HTTP, with other words: it tells user agents to treat all of a web-page insecure URLs (if they getting served with HTTP) as though they have been replaced with secure HTTPS URLs.Sometimes it can be a good way to automatically fix mixed content issues when ypu are migr...
 •  0 comments  •  flag
Share on Twitter
Published on April 28, 2021 02:11

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...
 •  0 comments  •  flag
Share on Twitter
Published on April 26, 2021 11:01

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...
 •  0 comments  •  flag
Share on Twitter
Published on April 26, 2021 10:52

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...

 •  0 comments  •  flag
Share on Twitter
Published on April 24, 2021 16:56

April 23, 2021

JSON Parsing in iOS using Swift

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...

 •  0 comments  •  flag
Share on Twitter
Published on April 23, 2021 04:18

Basics of stable matching

Introduction to Graph 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 matching

Size of a matching is equal is to the number of edges present in the matching.

Perfect Matching

A matching is called perfect if it contains all the vertices present in the graph. Perfect matching is also known as Complete matching.

Bipartite graphs

A bipartite graph is a graph whose vertices can be divided into
two disjo...

 •  0 comments  •  flag
Share on Twitter
Published on April 23, 2021 04:15

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 operation:This function is used to insert new data into the queue based on priority.Pseudocode for Push operation:

PUSH(HEAD,DATA,PRIORITY):

Step 1:...
 •  0 comments  •  flag
Share on Twitter
Published on April 23, 2021 04:00

Bit header file in C++20

The header was included in C++20.

Introduction

The 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 representation

Binary 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...

 •  0 comments  •  flag
Share on Twitter
Published on April 23, 2021 03:39

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...

 •  0 comments  •  flag
Share on Twitter
Published on April 23, 2021 03:31