
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

162 Views
Suppose we have an array called nums represents an encoding of a binary string of size k, we have to check whether given encoding uniquely finds a binary string or not. Here the encoding has counts of contiguous 1s which are separated by single 0s.So, if the input is like nums = [4, 2, 3] k = 11, then the output will be True as there is a binary string like 11110110111 of k = 11.To solve this, we will follow these steps −total := sum of all elements in numstotal := total + size of nums - 1return true ... Read More

583 Views
The Binary Search Tree (BST) is a widely used data structure that maintains the elements in a sorted hierarchical order. Each node in the BST follows the specific property: The values in the left subtree are always less than the values of the current node. The values in the right subtree are always greater than the node. In this article, we are going to learn about checking if an array represents the inorder of a BST or not in Python. Checking for inorder of the BST Inorder traversal is the ... Read More

180 Views
Suppose we have an array nums which only stores 1 and 2 in it. We have to check whether the array can be divided into two different parts such that sum of elements in each part is same.So, if the input is like nums = [1, 1, 2, 2, 2], then the output will be True as we can divide this array like [1, 1, 2] and [2, 2] the sum of each part is 4.To solve this, we will follow these steps −total := 0, one_count := 0total := sum of all elements of numsone_count := count of 1s ... Read More

317 Views
Suppose we have an array nums of unique elements from 1 through n. We have to check whether it is stack-sortable or not. An array is stack sortable when it can be stored in some other array using a temporary stack.To solve this, we can use any of these operations on the array −Delete the starting element of array and push that item into the stack.Delete the top element of the stack and insert it to the end of second array.Now if all the element of the given array is transferred to the second array by these operations so the ... Read More

2K+ Views
Suppose we have an array called nums. We also have two numbers x and y defining a range [x, y]. We have to check whether the array contains all elements in the given range or not.So, if the input is like nums = [5, 8, 9, 6, 3, 2, 4] x = 2 y = 6, then the output will be true as there are all elements [2, 3, 4, 5, 6].To solve this, we will follow these steps −temp_range := y - xfor i in range 0 to size of nums, doif |nums[i]| >= x and |nums[i]| 0, ... Read More

257 Views
Check if Array Can Be Divided into Pairs with Sum Divisible by K In this article, we are given an array of integers and a number k. The task is to determine whether it is possible to divide the entire array into pairs such that the sum of every pair is divisible by k. For example, if the given array of integers is [2, 4, 1, 3], and a value k = 5. The task is to form pairs (two elements at a time) from the array such that when you add each pair, the result is divisible by ... Read More

172 Views
Suppose we have a binary string str, we have to check whether all of the 1s in the string are equidistant or not. In other words, the distance between every two 1s is same. And the string contains at least two 1s.So, if the input is like s = "100001000010000", then the output will be True as the 1s are at distance 4 from each other.To solve this, we will follow these steps −index := a new listfor i in range 0 to size of s, doif s[i] is same as 1, theninsert i at the end of indext := ... Read More

249 Views
Suppose we have a number n, we have to check whether all sub-numbers of this number have unique digit product or not. As we know, n digit number has n*(n+1)/2 sub-numbers. For example, the sub-numbers of 135 are 1, 3, 5, 13, 35, 135. And the digit product of a number is product of its digits.So, if the input is like n = 235, then the output will be True as sub numbers are [2, 3, 5, 23, 35, 235], digit products are [2, 3, 5, 6, 15, 30]To solve this, we will follow these steps −Define a function dig_prod() ... Read More

136 Views
Suppose we have a number n denotes n people and there are two identical voting machines. We also have an array called time of size n such that time[i] represents total time spent by i-th person to vote on any machine. At one time instant, only one person can be there on each of the two machines. We also have another value x, representing the maximum allowable time for which machines are operational, we have to check whether all persons can place their vote or not.So, if the input is like n = 3, x = 7, time = [3, ... Read More

1K+ Views
In this tutorial, we are going to learn how to delete all prime nodes from a singly linked list.Let's see the steps to solve the problem.Write struct with data and next pointer.Write a function to insert the node into the singly linked list.Initialize the singly linked list with dummy data.Iterate over the singly linked list.Delete alternate node by maintaining the previous node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is head node, then move the head to next node.If the node is middle node, then link the next node to ... Read More