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 1643 of 3366
625 Views
We are provided two numbers N which defines a range [1, N] and D which is a difference.The goal is to find all the numbers in the range [1, N] such that the [ number - (sum of its digits) ] > D. We will do this by traversing numbers from 1 to N and for each number we will calculate its digit sum using a while loop. Check if the number and calculated digit sum has a difference more than D.Let’s understand with examples.Input N=15 D=5Output Numbers such that difference b/w no. and its digit sum greater than value D: 6Explanation Numbers ... Read More
250 Views
We are provided two numbers START and END to define a range of numbers.The goal is to find all the numbers in the range [START, END] that are divisible by all of its non-zero digits . We will do this by traversing numbers from START to END and for each number we will check if the number is divisible by all non-zero digits using a while loop. If yes increment count.Let’s understand with examples.Input START=10 END=20Output Numbers that are divisible by all its non-zero digits: 14Explanation Numbers 10, 11, 12, 15, 20 are divisible by all their non-zero digits.Input START=100 END=200Output Numbers that are divisible ... Read More
647 Views
We are provided a number N. The goal is to find the numbers that are divisible by X and not by Y and are in the range [1, N].Let’s understand with examples.Input N=20 X=5 Y=20Output Numbers from 1 to N divisible by X not Y: 2Explanation Only 5 and 15 are divisible by 5 and not 10.Input N=20 X=4 Y=7Output Numbers from 1 to N divisible by X not Y: 5Explanation Numbers 4, 8, 12, 16 and 20 are divisible by 4 and not 7.Approach used in the below program is as followsWe take an integer N.Function divisibleXY(int x, int y, int n) returns a count ... Read More
652 Views
We are provided two numbers START and END to define a range of numbers. And also an array of positive numbers Arr[]. The goal is to find all the numbers that are divisible by all elements of Arr[] and are in the range [START, END] .Method 1 ( Naive Approach )We will do this by traversing numbers from START to END and for each number we will check if the number is divisible by all elements of the array. If yes increment count.Method 2 ( check divisibility by LCM of array elements )We will find the LCM of all array ... Read More
2K+ Views
We are provided a number N. The goal is to find the numbers that have 0 as digit and are in the range [1, N].We will do this by traversing numbers from 10 to N ( no need to check from 1 to 9 ) and for each number we will check each digit using a while loop. If any digit is found as zero increment count and move to next number otherwise reduce the number by 10 to check digits until number is >0.Let’s understand with examples.Input N=11Output Numbers from 1 to N with 0 as digit: 1Explanation Starting from i=10 to ... Read More
774 Views
We are provided two numbers START and END to define a range of numbers. The goal is to find the numbers that have only 2 and 3 as their prime factors and are in the range [START, END].We will do this by traversing numbers from START to END and for each number we will check if the number is divisible by 2 and 3 only. If divisible, divide it and reduce it. If not, break the loop. In the end if the number is reduced to 1 then it has only 2 and 3 as its factors.Let’s understand with examples.Input START=20 ... Read More
264 Views
We are given an array Arr[] of integers with length n and a number M. The array is only containing positive integers. The goal is to count the triplets of elements of Arr[] which have product equal to M.We will do this by using three for loops. Increment count if arr[x]*arr[y]*arr[z]=M and x!=y!=z. (0
1K+ Views
In this post, we will go through the options handling large CSV files with Pandas.CSV files are common containers of data, If you have a large CSV file that you want to process with pandas effectively, you have a few options.Pandas is an in−memory toolYou need to be able to fit your data in memory to use pandas with it. If you can process portions of it at a time, you can read it into chunks and process each chunk. Alternatively, if you know that you should have enough memory to load the file, there are a few hints to ... Read More
406 Views
Suppose we have a list of numbers called nums, we have to check whether every number can be grouped using one of the following rules: 1. Contiguous pairs (a, a) 2. Contiguous triplets (a, a, a) 3. Contiguous triplets (a, a + 1, a + 2)So, if the input is like nums = [7, 7, 3, 4, 5], then the output will be True, as We can group [7, 7] together and [3, 4, 5] together.To solve this, we will follow these steps −n := size of numsdp := a list of size n+1, first value is True, others are ... Read More
308 Views
Suppose we have a value n. We have to find all upside down numbers of length n. As we knot the upside down number is one that appears the same when flipped 180 degrees.So, if the input is like n = 2, then the output will be ['11', '69', '88', '96'].To solve this, we will follow these steps −Define a function middle() . This will take xif x is 0, thenreturn list of a blank stringif x is same as 1, thenreturn a new list of elements 0, 1, 8ret := a new listmid := middle(x − 2)for each m ... Read More