Top 10 Python Applications in Real World

We are living in a digital world that is completely driven by chunks of code. Every industry depends on software for its proper functioning be it healthcare, military, banking, research, and the list goes on. We have a huge list of programming languages that facilitate the software development process. One of these is Python which […]

Continue Reading

Find minimum value expression by inserting addition or multiplication operator between digits of given number

Given string str that contains only digits, the task is to return an expression by inserting the ‘+’ or ‘*’ operator between every two digits such that the arithmetic value of the expression is minimized.Example: Input: str = “322”Output: “3+2*2”Explanation: The value of above expression is 7 which is minimum possible over the other expressions “3+2+2”, […]

Continue Reading

Find the missing value from Array B formed by adding some value X to Array A

def findHiddenMissing(arr1, arr2, N):            arr1.sort()    arr2.sort()        mp = {}            for i in range(0, N – 1):                                                               a = arr2[i] – arr1[i]                                b = arr2[i] – arr1[i + 1]                if (a != b):                                    if (a > 0):                if not a in mp:                    mp[a] = 1                else:                    mp[a] += 1                                if (b > 0):                if not b in mp:                    mp[b] = 1                else:                    mp[b] += 1                        else:                                    if (a > 0):                if not a in mp:                    mp[a] = […]

Continue Reading

Minimum number of deques required to make the array sorted

#include using namespace std;int minDeques(vector arr){            vector fronts, backs;        for (int i = 0; i < arr.size(); i++) {                        bool hasBeenPushed = false;        for (int j = 0; j < fronts.size(); j++) {                                    if (arr[i] < fronts[j]) {                bool isSafe = true;                for (int k = 0; k < arr.size(); k++) {                    if (arr[i] < arr[k]                        && arr[k] < fronts[j]) {                        isSafe = false;                        break;                    }                }                                                if (isSafe) […]

Continue Reading