
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

211 Views
Suppose we have a list of scores of N athletes, we have to find their relative ranks and the people with the top three highest scores, who will be different medals: "Gold", "Silver" and "Bronze".So, if the input is like [2, 5, 3, 1, 0], then the output will be [Bronze, Gold, Silver, 4, 5]To solve this, we will follow these steps −if size of nums is same as 1, then −return "Gold"if size of nums is same as 2, then −if nums[0] > nums[1], then −return "Gold", "Silver"Otherwisereturn "Silver", "Gold"Define an array vDDefine an array vecfor initialize i := ... Read More

275 Views
Given a list of words, we have to find those words that can be typed using letters of the alphabet on only one row's of standard keyboard layout.So, if the input is like ["hello", "world", "mom", "dad", "try", "type", "tom"], then the output will be ["dad", "try", "type"]To solve this, we will follow these steps −Define an array outputoneRow := trueDefine one map charToRowMap, this will take all pairs such that {letter, line}, the letter is the letter present on the keyboard, and line is the line number on the keyboard.for each word in words array −if the word is ... Read More

340 Views
Suppose we have a specific rectangular web page area, our job is to design a rectangular web page, whose length L and width W that satisfies the following requirements −The area of the web page must equal to the given target area.The width W should not be larger than the length L, and L >= W.The difference between L and W should be as small as possible.So, if the input is like 4, then the output will be [2, 2], as the target area is 4, and all the possible ways to construct it are [1, 4], [2, 2], [4, ... Read More

306 Views
Suppose we have to design a standard heater with a fixed warm radius to warm all the houses. Now, we have given positions of houses and heaters on a horizontal line, we have to find the minimum radius of heaters so that all houses could be covered by those heaters. So, we will provide houses and heaters separately, and our expected output will be the minimum radius standard of heaters.So, if the input is like [1, 2, 3, 4], [1, 4], then the output will be 1 as the two heaters was placed in position 1 and 4. We have ... Read More

2K+ Views
Suppose we have an array of size n, we have to find the minimum number of moves required to make all array elements the same, where a move means incrementing n - 1 elements by 1.So, if the input is like [3, 2, 3, 4], then the output will be 4.To solve this, we will follow these steps −n := size of numsif n is same as 0, then −return 0sort the array numsans := 0for initialize i := 0, when i < n, update (increase i by 1), do −ans := ans + nums[i] - nums[0]return ansExample Let us see ... Read More

362 Views
Suppose we have n points in the plane that are all pairwise distinct. Now a "boomerang" is a tuple of points like (i, j, k) such that the distance between i and j is the same as the distance between i and k. We have to find the number of boomerangs.So, if the input is like [[0, 0], [1, 0], [2, 0]], then the output will be 2, as two boomerangs are [[1, 0], [0, 0], [2, 0]] and [[1, 0], [2, 0], [0, 0]].To solve this, we will follow these steps −counter_of_boomerangs := 0for each point_1 in points array, ... Read More

380 Views
In this problem, we have n number of coins. To arrange these coins in a staircase shape such that each row consists of k number of coins, where k is the row number in which the coins are placed. The last row may or may not be completely filled. Our task is to find the number of completely filled rows. Here is a scenario of arranging coins problem: Scenario Input: n = 8 Output: 3 Explanation: In the above figure, we can see there are 3 completely filled rows and the ... Read More

559 Views
Suppose we have a string s. We have to count the number of segments in a string, where a segment is defined to be a contiguous sequence of characters (no whitespace).So, if the input is like "Hello, I love programming", then the output will be 4, as there are 4 segments.To solve this, we will follow these steps −n := 0for initialize i := 0, when i < size of s, update (increase i by 1), do −if s[i] is not equal to white space, then −(increase n by 1)while (i < size of s and s[i] is not equal ... Read More

422 Views
Suppose we have a non-empty array of integers; we have to find the third maximum number in this array. If there is no 3rd max number, then return the maximum one. The challenge is, we have to solve this using linear time complexity.So, if the input is like [5, 3, 8, 9, 1, 4, 6, 2], then the output will be 6.To solve this, we will follow these steps −initialize a, b, c with NULLfor initialize i := 0, when i < size of nums, update (increase i by 1), do −if a is null or nums[i] >= value of ... Read More

2K+ Views
Suppose we have a string which consists of lowercase or uppercase letters, we have to find the length of the longest palindromes that can be built with those letters. Now the string is case sensitive, so "Aa" is not considered a palindrome here.So, if the input is like "abccccdd", then the output will be 7, as one longest palindrome that can be built is "dccaccd", whose length is 7.To solve this, we will follow these steps −Define one map mpfor each character i in s(increase mp[i] by 1)ma := 0, c := 0, ans := 0for each key-value pair i ... Read More