Arnab Chakraborty has Published 3734 Articles

Program to find all possible strings typed using phone keypad in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 08:15:07

1K+ Views

Suppose we have a string containing digits from 2-9. We have to find all possible letter combinations that the number could generate. One mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does map some characters but no letters.12a b c3d e ... Read More

Program to check whether a board is valid N queens solution or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 08:12:22

945 Views

Suppose we have a n x n matrix represents a chess board. There are some 1s and 0s, where 1 represents a queen and 0 represents an empty cell. We have to check whether the board is valid solution to the N-Queen puzzle or not. As we know a board ... Read More

Program to check whether we can unlock all rooms or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 08:08:16

321 Views

Suppose we have a list of lists called rooms. Each index i in rooms represents a room and rooms[i] represents different keys to open other rooms. The room 0 is open and we are at that room and every other room is locked. We can move freely between opened rooms; ... Read More

Program to find nth ugly number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 08:06:06

384 Views

Suppose we have a number n; we have to find the nth ugly number. As we know that the ugly numbers are those numbers, whose prime factors are only 2, 3 and 5. So if we want to find 10th ugly number, the output will be 12, as the first ... Read More

Program to check whether given list of blocks are symmetric over x = y line or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:49:12

424 Views

Suppose we have a list of numbers called nums. And it is representing the height of square blocks, we have to check whether the shape is symmetric over the y = x line or not.So, if the input is like nums = [7, 5, 3, 2, 2, 1, 1], then ... Read More

Program to sort a given linked list into ascending order in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:34:29

5K+ Views

Suppose we have a linked list. We have to sort the list into ascending order.So, if the input is like [5, 8, 4, 1, 5, 6, 3], then the output will be [1, 3, 4, 5, 5, 6, 8, ]To solve this, we will follow these steps:values := a new ... Read More

Program to find number of items left after selling n items in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:31:35

3K+ Views

Suppose we have a list of numbers called items and another value n. A salesman has items in a bag with random IDs. The salesman can delete as many as n items from the bag. We have to find the minimum number of different IDs in the bag after n ... Read More

Program to check whether leaves sequences are same of two leaves or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:21:57

143 Views

Suppose we have two binary trees; we have to check whether the sequence of leaves left-to-right in both trees are the same.So, if the input is likethen the output will be True as the sequence is [2, 6] for both trees.To solve this, we will follow these steps:c := a ... Read More

Program to reverse words separated by set of delimiters in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:16:15

419 Views

Suppose we have a string and a set of delimiters, we have to reverse the words in the string while the relative ordering of the delimiters should not be changed.So, if the input is like s = "Computer/Network:Internet|tutorialspoint" delims = ["/", ":", '|'], then the output will be tutorialspoint/Internet:Network|ComputerTo solve ... Read More

Program to reverse inner nodes of a linked list in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 07:12:45

247 Views

Suppose we have linked list, we also have two values i and j, we have to reverse the linked list from i to jth nodes. And finally return the updated list.So, if the input is like [1, 2, 3, 4, 5, 6, 7, 8, 9] i = 2 j = ... Read More

Advertisements