
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

150 Views
Suppose we have a text. We have to find the largest possible k such that there exists a[1], a[2], ..., a[k] such that: Each a[i] is a string which is not blank. And their concatenation a[1] + a[2] + ... + a[k] is equal to the given text; For all i in range 1 to k, a[i] = a[{k+1 - i}].So, if the input is like text = "antaprezatepzapreanta", then the output will be 11 because we can split it like "a|nt|a|pre|za|tpe|za|pre|a|nt|a".To solve this, we will follow these steps −counter := 0i := 1, j := size of text - ... Read More

239 Views
Suppose we have an array nums, we have to split the array into some number of partitions, and individually sort each of them. Now after concatenating them we will get one sorted array. We have to find the maximum number of partitions we could have made?So, if the input is like [3, 2, 4, 5, 5], then the output will be 4, as we can make partitions like [3, 2], [4], [5], [5] .To solve this, we will follow these steps −real:= sort the list numsp1 := 0, p2 := 1, c := 0Do the following infinitely, doflag:= Truetmp:= sort ... Read More

171 Views
Suppose, we are given a weighted, undirected graph. We have to implement a function query that takes two vertices and a cost 'limit' as input and checks if there exists a lower cost path than the cost given as input. We return true if there exists a path or otherwise, we return false.So, if the input is likeand the queries are (0, 2, 10), (3, 1, 30), (4, 3, 30).then the output will beFalse True TrueThe result of the first query is False because there is no path between vertex 0 to 2 of cost 10.The result of the second ... Read More

177 Views
Suppose we have two strings, s and t. We want to make a string in the following manner −Select some non-empty subsequence sub1 from s.Select some non-empty subsequence sub2 from t.Concatenate sub1 and sub2, to make the string.We have to find the length of the longest palindrome that can be formed in the described manner. If we cannot make any palindrome, then return 0.So, if the input is like s = "hillrace" t = "cargame", then the output will be 7 because we can take "race" from s and "car" from r, so "racecar" is the palindrome with length 7.To ... Read More

151 Views
Suppose we have a starting points (sx, sy), and target point (tx, ty), we have to check whether a sequence of moves exists from the start point to the end point. Here move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y).So, if the input is like (sx, sy) = (1, 1) (tx, ty) = (4, 5), then the output will be True, this is because move (1, 1) to (2, 1), then (3, 1), then (4, 1), then (4, 5).To solve this, we will follow these steps −Define a function solve() ... Read More

563 Views
Suppose, there are n number of candies and k bags in which the candies have to put into. We have to find out the number of possible ways the candies can be distributed so that each bag contains at least one candy. Every candy in this scenario is unique, so we have to count all the possible ways the candies can be distributed in the bags.So, if the input is like n = 3, k = 2, then the output will be 3.The candies can be put in this manner −(1, 2), (3) (1) , (2, 3) (2), (1, 3)To ... Read More

291 Views
Suppose we have an array nums, we have to find the maximum min-product of each non-empty subarray of nums. Since the answer can be big enough, return it in modulo 10^9+7. The min-product of the array is equal to the minimum value in the array multiplied by the sum of the array. So if we have an array is like [4, 3, 6] (minimum value is 3) has a min-product of 3*(4+3+6) = 3*13 = 39.So, if the input is like nums = [2, 3, 4, 3], then the output will be 30 because we can get subarray [3, 4, ... Read More

252 Views
Suppose we have a string s with only numbers. We have to check whether we can split s into two or more non-empty substrings such that the numerical values of those substrings are in non-increasing sequence and the difference between numerical values of every two adjacent substrings is 1. So for example, if the string is s = "0080079" we can split it into ["0080", "079"] with numerical values [80, 79]. And the values are in descending order and adjacent values differ by 1, so this way is valid. We have to check whether it is possible to split s ... Read More