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
Programming Articles - Page 1457 of 3363
254 Views
We are given with an integer range, a variable m which is used as divisor and a variable d which is used to check whether the digit 'd' is at even position or not and the task is to calculate the count of those numbers in a range which are divisible by the variable m and have digit d in even positions.For ExampleInput - int start = 20, end = 50, d = 8 and m = 4Output - Count of Numbers in a Range divisible by m and having digit d in even positions are: 2Explanation - The range ... Read More
387 Views
We are given an integer range starting from the variable let's say start till the variable end and a variable k and the task is to calculate the count of numbers in the range such that the numbers don't have more than 'k' non-zero digits.For ExampleInput - int start = 50, end = 100 and K = 2;Output - Count of Numbers in Range where the number does not contain more than K non zero digits are: 50Explanation - The range is starting from 50 to 100 and we are given k as 2. As we can see, all the ... Read More
540 Views
We are given with two different strings let's say s1 and s2 and the task is to form the string let's say S by combining the unique letters of s1 and s2 and now check whether after removing one character from the string S it is forming a string which will be equal to string s1 OR s2.For ExampleInput - string S1 = "utter", string S2 = "butter"; Output - Count of strings that become equal to one of the two strings after one removal are: 1Explanation - we are given with string s1 and s2 and we will from string S ... Read More
433 Views
We are given an input as a string, the task is to find out the count of pairs of non-overlapping palindromic sub-strings of the given input string. The value of arr[i][j] is true if the substring is a palindrome, otherwise false. We will take combination out of the string and check if the pairs fulfil the criteria.Let us understand with examples.Input: ABCOutput: Count pairs of non-overlapping palindromic sub-strings is 3Explanation: The possible pairs are (A) (B) (C) ,(A) (BC), (AB) (C), (ABC) Input: ABCDOutput: Count pairs of non-overlapping palindromic sub-strings is 8Explanation: The possible pairs are (A)(B)(C)(D), (A)(B)(CD), (A)(BC)(D), (A)(BCD), (AB)(C)(D), (AB)(CD), (ABC)(D), (ABCD) Approach ... Read More
498 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
493 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
178 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