
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 7197 Articles for C++

244 Views
Suppose we have a string called croakOfFrogs, this represents a combination of the string "croak" from different frogs, multiple frogs can croak at the same time, so multiple "croak" are mixed. We have to find the minimum number of different frogs to finish all the croak in the given string.Here a valid "croak" means a frog is generating 5 letters ‘c’, ’r’, ’o’, ’a’, ’k’ sequentially. The frogs have to generate all five letters to finish a croak. If the string is not a valid "croak" string then return -1.So, if the input is like "crcoakroak", then the output will ... Read More

375 Views
Suppose we have an array orders, which represents the orders that customers have done in a restaurant. So, orders[i]=[cust_namei, table_numi, food_itemi] where cust_namei is the customer name, table_numi is the customers table number, and food_itemi is the item customer orders.We have to return the restaurant's “display table”. Here the “display table” is a table whose row entries denote how many of each food item each table ordered. The first column will be the table number and the remaining columns correspond to each food item in alphabetical order. First row should be a header whose first column is “Table”, followed by ... Read More

235 Views
Suppose we have a string. We will call that a happy string when it consists of only ['a', 'b', 'c'] letters, and s[i] != s[i + 1] for all values of i from 1 to length of s - 1 (here the string is 1-indexed).So, if we have two integers n and k, consider a list of all happy strings of length n sorted in lexicographical order. We have to find the the kth string of this list or return an empty string if there are less than k happy strings of length nSo, if the input is like n ... Read More

483 Views
Suppose we have a number k, we have to find the minimum number of Fibonacci numbers whose sum is equal to the k, whether a Fibonacci number could be used multiple times.So, if the input is like k = 7, then the output will be 2, as the Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, ... For k = 7 we can use 2 + 5 = 7.To solve this, we will follow these steps −Define an array finsert 0 at the end of finsert 1 at the end of fwhile last element of f = 0 and k > 0), do −if f[j] 0) { if (f[j]

746 Views
Suppose we have a string; we have to design one HTML parser that will replace the special character of HTML syntax into normal character. The HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. These are the special characters and their entities for HTML −Quotation Mark − the entity is " and symbol character is ".Single Quote Mark − the entity is ' and symbol character is '.Ampersand − the entity is & and symbol character is &.Greater Than Sign − the entity is ... Read More

177 Views
Suppose we have an array queries of positive integers between 1 and m, we have to process all queries, queries[i] (from i=0 to n, n is the size of queries - 1) according to the following rules −At the beginning, we have the permutation P=[1, 2, 3, ..., m].For the current i, find the position of queries[i] in the permutation P (indexing from 0) and then move this at the beginning of the permutation P.We have to find an array containing the result for the given queries.So, if the input is like queries = [3, 1, 2, 1], m = ... Read More

693 Views
Suppose there is a string. That string is called happy if it does not have any of the strings like 'aaa', 'bbb' or 'ccc' as a substring. If we have three integers like a, b and c, then return any string s, which satisfies the following conditions −s is happy and longest possible.s contains at most an occurrence of the letter 'a', at most b occurrences of the letter 'b' and at most c occurrences of the letter 'c'.s will only contain 'a', 'b' and 'c' letters.If there is no such string, then return an empty string.So, if the input ... Read More

250 Views
Suppose we have a number s in binary form. We have to find the number of steps to reduce it to 1 under these rules −If the current number is even, we have to divide it by 2.If the current number is odd, you have to add 1 to it.So, if the input is like "1101", then the output will be 6, as "1101" is 13. So, 13 is odd, add 1 and obtain 14. Then 14 is even, divide by 2 and obtain 7. After that 7 is odd, add 1 and obtain 8.Then 8 is again, even so, ... Read More

453 Views
Suppose we have a circle represented as (radius, xc, yc), here (xc, yc) is the center coordinate of the circle. We also have an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-left corner, and (x2, y2) are the coordinates of the top-right corner of the rectangle. We have to check whether the circle and rectangle are overlapped or not.So, if the input is likethen the output will be true.To solve this, we will follow these steps −Define a function eval(), this will take a, b, c, return maximum of b and ... Read More

221 Views
Suppose we have a string s and a number k. We have to construct k non-empty palindrome strings using all the characters in s. So here we have to check whether we can use all the characters in s to construct k palindrome strings or not.So, if the input is like "true", k = 4, then the output will be True, as the only possible solution is to put each character in a separate string.To solve this, we will follow these steps −n := size of sif n < k, then −return falseif n is same as k, then −return ... Read More