Question: 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
Get step-by-step solutions from verified subject matter experts
