# Tag Archives: digit-DP

## Find all possible ways to Split the given string into Primes

Given a string str that represents a number. The task is to find all possible ways to split the given string such that each segment… Read More »

## Count numbers in a range with digit sum divisible by K having first and last digit different

Given a range in the form of L and R, and a value K, the task is to count the numbers between the range L… Read More »

## Count numbers with exactly K non-zero digits and distinct odd digit sum

Given an Integer N, and a number K, the task is to find out the total numbers from 0 to N which have exactly K… Read More »

## Split the given string into Odds: Digit DP

Prerequisites: Digit-DP Given string str that represents a large number, the task is to find the minimum number of segments the given string can be… Read More »

## Count the numbers with N digits and whose suffix is divisible by K

Given two positive integers N and K, the task is to count the number of positive integers D such that D has N digits and… Read More »

## Count numbers less than N containing digits from the given set : Digit DP

Given an integer N and set of digits D[], which consists of digits from [1, 9]. The task is to count the numbers possible less… Read More »

## Count number of binary strings without consecutive 1’s : Set 2

Given a positive integer N, the task is to count all possible distinct binary strings of length N such that there are no consecutive 1’s.… Read More »

## Number of integers in a range [L, R] which are divisible by exactly K of it’s digits

Given a range of values [L, R] and a value K, the task is to count the numbers in the given range which are divisible… Read More »

## Count of integers from the range [0, N] whose digit sum is a multiple of K

Given two integers N and K, the task is to calculate the number of integers in the range [0, N] whose digit sum is a… Read More »

## Count of N-digit numbers in base K with no two consecutive zeroes

Given two integers N and K, the task is to find the count of all the integer in base K which satisfy the following conditions:… Read More »

## Count numbers in given range such that sum of even digits is greater than sum of odd digits

Given two integers L and R denoting a range [L, R]. The task is to find the total count of numbers in the given range… Read More »

## Number of n digit stepping numbers | Space optimized solution

Given n, find count of n digit Stepping numbers. A number is called stepping number if all adjacent digits have an absolute difference of 1.… Read More »

## Longest subsequence such that adjacent elements have at least one common digit

Given an array arr[] of N integers, the task is to find the length of the longest sub-sequence such that adjacent elements of the sub-sequence… Read More »

## Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime

Given a range [L, R]. The task is to count the numbers in the range having difference between the sum of digits at even position… Read More »

## Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M

Given a range [L, R] and two positive integers N and M. The task is to count the numbers in the range containing only non-zero… Read More »