Fork me on GitHub

Introduction to List-based Data Structures with SARL

Note If you don’t know how to solve an problem, or what is the function to be used, you could search on Internet for the answer using the API of the Java programming language. Indeed, since SARL is fully compatible with the Java API, you could use all the types or functions that are defined in this Java API.

1. Exercise 1

Answer

## 2. Exercise 2 * Write a SARL program to multiply all the items in a list. Answer ## 3. Exercise 3 * Write a SARL program to get the largest number from a list. Answer ## 4. Exercise 4 * Write a SARL program to count the number of strings from a given list of strings. The string length is 2 or more and the first and last characters are the same. * Sample List : `['abc', 'xyz', 'aba', '1221']` * Expected Result : `2` Answer ## 5. Exercise 5 * Write a SARL program to get a list, sorted in increasing order by the last element in each tuple from a given list of non-empty tuples. * Sample List : `[(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]` * Expected Result : `[(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)]` Answer ## 6. Exercise 6 * Write a SARL program to remove duplicates from a list. Answer

7. Exercise 7

Answer

## 8. Exercise 8 * Write a SARL program to clone or copy a list. Answer

9. Exercise 9

Answer