Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a function that takes a list L of integers and another integer n, and returns true if L contains n and false otherwise.
1. Write a function that takes a list L of integers and another integer n, and returns true if L contains n and false otherwise. boolean contains (int[] L, int n) { // your code here } If L = [1, 3, 5, 3, 3, 2, 1, 7, 5], then contains (L, 3) returns true and contains (L, 4) returns false. 2. Write a function that takes a list L of integers and returns a list that contains the unique items in L (in the order of their first appearance in L). int[] uniqueList(int[] L) { // your code here } For example: If L = [1, 3, 5, 3, 3, 2, 1, 7, 5], then uniqueList(L) returns [1, 3, 5, 2, 7]
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