Arnab Chakraborty has Published 4293 Articles

Unique Morse Code Words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:04:01

578 Views

Suppose we have a list of words, here each word can be written as a concatenation of the Morse code of each letter. For example, the word "cba" can be written as "-.-..--...", this is the concatenation "-.-." | "-..." | ".-"). This kind of concatenation is called the transformation ... Read More

Prime Number of Set Bits in Binary Representation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:02:34

291 Views

Suppose we have two integers L and R, we have to find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary form.So, if the input is like L = 6 and R = 10, then the output will be ... Read More

Shortest Completing Word in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 10:00:10

385 Views

Suppose we have a dictionary words, and we have to find the minimum length word from a given dictionary words, it has all the letters from the string licensePlate. Now such a word is said to complete the given string licensePlate. Here, we will ignore case for letters. And it ... Read More

Largest Number At Least Twice of Others in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:58:03

432 Views

Suppose we have an integer array called nums, now there is always exactly one largest element. We have to check whether the largest element in the array is at least twice as much as every other number in the array. If it is so, then we have to find the ... Read More

Min Cost Climbing Stairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:57:40

876 Views

Suppose there is a staircase, here the i-th step will be some non-negative cost value cost[i] assigned. When we pay the cost, we can either climb one or two steps. We have to find minimum cost to reach the top of the floor, and we also can either start from ... Read More

Find Smallest Letter Greater Than Target in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:55:28

1K+ Views

Suppose we have a list of sorted characters’ letters. This is containing only lowercase letters, now we have a target letter t, we have to find the smallest element in the list that is larger than the given target.And letters also wrap around. So, if the target is t = ... Read More

Longest Word in Dictionary in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:55:08

540 Views

Suppose we have a list of words representing an English Dictionary, we have to find the longest word in the given word list that can be built one character at a time by other words in words. If there is more than one possible answer, then return the longest word ... Read More

Design HashMap in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:50:24

2K+ Views

Suppose we want to design a HashMap without using any built-in hash table libraries. There will be different functions as follows −put(key, value) − This will insert a value associated with key into the HashMap. If the value already exists in the HashMap, update the value.get(key) − This will return ... Read More

Design HashSet in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:48:10

4K+ Views

Suppose we want to design a HashSet data structure without using any built-in hash table libraries. There will be different functions like −add(x) − Inserts a value x into the HashSet.contains(x) − Checks whether the value x is present in the HashSet or not.remove(x) − Removes x from the HashSet. ... Read More

Kth Largest Element in a Stream in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Jul-2020 09:44:48

577 Views

Suppose we want to design a class to find the kth largest element in a stream. It is the kth largest element in the sorted order, not the kth distinct element.The KthLargest class will have a constructor which accepts an integer k and an array nums, that will contain initial ... Read More

Advertisements