
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 33676 Articles for Programming

437 Views
We are given an input as a text stream and a word, and the task is to find out the count of occurrences of anagrams of the word in the given text stream. Anagrams are generated by rearranging letters from a word which ends up being a different word or phrase like anagrams of words in a statement "New York Times" can be formed as "Monkeys write".For ExampleInput: String string-: “workitwrokoffowkr” word = “work” Output: Count of occurrences of anagram in the string are: 3Explanation: The possible anagrams for the word “work” are work, wrok, rowk, owkr, etc. In the ... Read More

435 Views
We are given an array containing integer elements and the task is to firstly calculate the subarray out of the given array and then check whether the elements in a subarray are in increasing order or not. If yes, then we will consider the subarray else it will be discarded.The approach here is to stop further checking the subarray if the elements in 0th and 1th position are not in increasing order.For Example- in C++Input: int a[] = {1, 7, 5}Output: Count of strictly increasing subarrays is 1Explanation - The possible subarrays include {1, 7, 5}, {1, 7}, {7, 5} where ... Read More

146 Views
Given two numbers start and end representing a range of positive integers. The goal is to find the count of all the numbers that lie in range [start, end] and have prime factorization such that all prime factors of that number have powers such that they have GCD as 1.If a number has prime factorization as 2p * 3q * 5r ….. Then powers p, q, r ...should have gcd=1.Let us understand with examples.For ExampleInput - start = 1, end = 10 Output - Count of numbers in a range having GCD of powers of prime factors equal to 1 are: 6Explanation ... Read More

1K+ Views
Given an undirected graph containing the nodes of a tree as vertices. The goal is to find the count of nodes at a given level of the tree using BFS( breadth first search ) algorithm.BFS Algorithm:-This algorithm starts traversing the graph/tree level by level. Starting from node at level 0, it will first traverse all nodes directly connected to it at level 1, then will traverse all nodes at next level and so on.Traverse nodes horizontally at current level.Traverse nodes at the next level in a similar manner.Let us understand with examples.For ExampleInput - level=2Output - Count of number of ... Read More

2K+ Views
Given a string str containing a number and a sum total as input. The goal is to find numbers upto str that have sum of digits equal to total.Let us understand with examples.For ExampleInput - N=”110” sum=5Output - Count of numbers smaller than or equal to N with given digit sum are: 7Explanation - The numbers upto 110 that have sum of digits equal to 5 are :-5, 14, 23, 32, 41, 50 and 104.Input - N=”1000” sum=3Output - Count of numbers smaller than or equal to N with given digit sum are: 10Explanation - The numbers upto 1000 that ... Read More

270 Views
Given a row x col matrix as input. The goal is to find all submatrices within the matrix[row][col] such that the sum of elements of that submatrix is divisible by integer k.If the matrix is mat[3][3] and k is 4 then submatrices will be as shown below:- Let us understand with examples.For ExampleInput - matrix[3][3] = { {1, 1, 1}, {2, 2, 2}, {3, 3, 3} } k=4Output - Count of sub-matrices having sum divisible 'k' are: 4Explanation - The submatrices will be as shown in above.Input - matrix[3][3] = { {1, 1, 1}, {2, 2, 2 }, {3, 3, ... Read More

508 Views
Given a range of numbers between start and end. The goal is to find the count of numbers that have the first digit equal to the last digit and fall in the range [ first, last ].All single digit numbers will be counted if they lie in the range.Let us understand with examples.For ExampleInput - start = 100, end = 200Output - Count of Numbers in Range where first digit is equal to last digit of the number are: 10Explanation - The numbers will be:101, 121, 131, 141, 151, 161, 171, 181 and 191.Input - start = 1, end = ... Read More

410 Views
Given a positive number as the number of digits and a sum. The goal is to find all d digit numbers that have sum of digits equal to the input sum. The numbers having leading zeros will not be considered as d digit numbers.The ranges are digits between 1 to 100 and sum between 1 and 500.Let us understand with examples.For ExampleInput - digits = 3, digi_sum = 3Output - Count of n digit numbers whose sum of digits equals to given sum are: 6Explanation - Three digit numbers having sum of digits as 3 are:102, 111, 120, 201, 210, ... Read More

812 Views
Given a positive number N as input. The goal is to find the number of ways in which we can express N as a sum of 1s, 3s and 4s only. For example, if N is 4 then it can be represented as 1+1+1+1, 3+1, 1+3, 4 so the number of ways will be 4.Let us understand with examples.For ExampleInput - N=5Output - Count of different ways to express N as the sum of 1, 3 and 4 are: 6Explanation - 5 can be represented as:1+1+1+1+11+3+13+1+11+1+34+11+4Input - N=6Output - Count of different ways to express N as the sum of ... Read More