Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 4 (Meera array) - A Meera array is defined to be an array containing only numbers as its elements and for all n values
Question 4 (Meera array) - A Meera array is defined to be an array containing only numbers as its elements and for all n values in the array, the value n2 is not in the array. So [3,5,2] is a Meera array because 32,52 or 22 are not in the array. But [8,3,4] is not a Meera array because 24=8 and both 4 and 8 are elements found in the array. Write a function that takes an array of numbered elements and prints "I am a Meera array" in the console if its array does NOT contain n and also n2 as value. Otherwise, the function prints "I am NOT a Meera array" Test 1: checkMeera([10,4, 0,5]) outputs "I am NOT a Meera array" because 5 * 2 is 10 Test 2: checkMeera([7, 4, 9]) outputs "I am a Meera array" Test 1: checkMeera([1, -6,4,-3]) outputs "I am NOT a Meera array" because 3 2 is 6 Question 5 (Dual array) - Define a Dual array to be an array where every value occurs exactly twice. For example, {1,2,1,3,3,2} is a dual array. The following arrays are not Dual arrays {2,5,2,5,5}(5 occurs three times instead of two times) {3,1,1,2,2} (3 occurs once instead of two times) Write a function named isDual that returns 1 if its array argument is a Dual array. Otherwise it returns 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started