- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Hafeezul Kareem has Published 345 Articles
Hafeezul Kareem
282 Views
Given a number n, we have to find the number of integers with an odd number of set bits in their binary form. Let's see an example.Inputn = 10Output5There are 5 integers from 1 to 10 with odd number of set bits in their binary form.AlgorithmInitialise the number N.Write a ... Read More
Hafeezul Kareem
119 Views
You are given an array, and indexes range. You need to count the total number of adjacent elements that are equal in the given range.Let's see an example.Inputarr = [1, 2, 2, 2, 3, 3, 4] lower = 1 upper = 5Output3AlgorithmInitialise the array and indexes range.Write a loop that ... Read More
Hafeezul Kareem
221 Views
Given an array of numbers, we need to find the number of groups of size 2 and 3 that are divisible by 3. We can get the sums of two and three combination numbers and check whether they are divisible by 3 or not.Let's see an example.Inputarr = [1, 2, ... Read More
Hafeezul Kareem
586 Views
The digit 1 represent positive pole whereas 0 represents negative pole.The magnet will have both poles as 10 or 01. A group can be formed with the magnets that attracts each other. The magnets with different pole facing each other will be in the same group.Here, you are given N ... Read More
Hafeezul Kareem
541 Views
Let's say you have given a binary string "10011". To make an alternate binary string, we need to flip a minimum of 2 characters as "10101".There are two possibilities for the alternate string. It will start with 0 or 1. We will check for two alternates and count the number ... Read More
Hafeezul Kareem
277 Views
Given a string of digits, we need to find the count of even substrings in it. Let's see an example.Inputnum = "1234"Output6The even substrings that can be formed from the given string are2 12 4 34 234 1234AlgorithmInitialise the string with digits.Initialise the count to 0.Iterate over the string.Get the ... Read More
Hafeezul Kareem
53 Views
You are given the result of the preorder traversal. You need to find the number of elements that are smaller than the root.The first element in the preorder traversal is the root of the BST. Let's see an example.Inputpreorder_result = [5, 4, 2, 1, 7, 6, 8, 9]Output3 There are ... Read More
Hafeezul Kareem
91 Views
You are given a number and subarray lower and upper bound indexes. You need to count a number of elements that are less than or equal to the given number. Let's see an example.Inputarr = [1, 2, 3, 4, 5, 6, 7, 8] k = 4 lower = 0 upper ... Read More
Hafeezul Kareem
88 Views
The modified mean of the matrix is defined as follows...(sum(row-wise min) + sum(column-wise max)) / (row_size + column_size)Let's see an example.1 2 3 4 5 6 7 8 9mean = (sum(1 + 4 + 7) + sum(7 + 8 + 9)) / (3 + 3)We have to find the mean ... Read More
Hafeezul Kareem
259 Views
You are given a number in string. You need to find how many digits need to be removed to make it divisible by 3.We make a number divisible by removing at most 2 digits. So, the maximum number of digits to be removed to make it divisible by 3 is ... Read More