Computer Science

Intersection of two Arrays

Given two arrays, return a new array which consists of the intersection of the provided arrays. Video explanation of the solution approaches for this problem is given below: https://www.youtube.com/watch?v=TuaW6-gj0Zs Possible Examples:Before jumping directly to the solution approaches, lets discuss about the possible inputs and their respective outputs. i/p: arr1 = [3,2,1,2,10]arr2 = [8,3,2,2,1] o/p: [3,2,2,1]… Continue reading Intersection of two Arrays

Computer Science

Add one to the number represented as an array of digits

Explanation : Consider a given integer array as input e.g. [2,8,9] which is an array representation of integer 289 where first index is the Most Significant Digit and last index is the Least Significant Digit. Add 1 to the Least Significant Digit such that the resultant array will be [2,9,0]. Video explanation of the solution… Continue reading Add one to the number represented as an array of digits