Dev Prakash Sharma has Published 585 Articles

Dev Prakash Sharma

Updated on 05-Feb-2021 11:50:17

The birthday paradox is a very famous problem in the section of probability.Problem Statement − There are several people at a birthday party, some are having the same birthday collision. We need to find the approximate number of people at a birthday party on the basis of having the same ... Read More

Dev Prakash Sharma

Updated on 05-Feb-2021 11:47:09

The birthday paradox is a very famous problem in the section of probability. The problem statement of this problem is stated as, There are several people at a birthday party, some are having the same birthday collision. We need to find the approximate no. of people at a birthday party ... Read More

Write a program in Python to replace all the 0’s with 5 in a given number

Dev Prakash Sharma

Updated on 05-Feb-2021 10:20:10

Given an Integer N the task is to replace all the 0’s that appear in the number with ‘5’. However, the number with leading ‘0’ cannot be replaced with ‘5’ as it remains unchanged. For example, Input-1 −N = 1007Output −1557Explanation − The given number has 2 zeros which when ... Read More

Majority Element in Python

Dev Prakash Sharma

Updated on 05-Feb-2021 08:10:17

Let’s suppose we have an array of integers. The task is to find the index of a particular element in the given array. For example, Input-1 −N = 8 A[ ] = { 1, 2, 4, 3, 3, 1, 1, 5}Output −1Explanation − In the given array of integers, the ... Read More

Counting elements in two arrays using C++

Dev Prakash Sharma

Updated on 05-Feb-2021 07:16:38

Let us assume that we have given two unsorted arrays arr1[] and arr2[]. The task is to count the total number of elements in arr2[] for which each element of arr1[] are less than or equal to the elements present in arr2[]. However, the element in both the array may ... Read More