Laborator 02
Problema 1:
Pentru o lista de numere primite ca parametru sa se afiseze sub-lista cu suma maxima.
Exemplu:
Cmd: "maxsumarray.exe -2 1 -3 4 -1 2 1 -5 4"
Output: 6
Explicatie: [4,-1,2,1] are cel mai mare sum = 6.
Problema 2:
Sa se construiasca un Map (dictionar) cu mai multe nivele unde fiecare cheie este o litera dintr-un cuvant iar valorea este fie urmatoarea litera din cuvant daca aceasta exista, fie numarul aparitiilor acelui cuvant. Pentru "abcd" si "adcb" ar arata astfel:
{
"a": {
"b": {
"c": {
"d": 1
}
},
"d": {
"c": {
"b": 1
}
}
}
}
Pentru o linie de comanda precum "freq.exe abcd adfc albc adbc arlv ab" sa se afiseze cate cuvinte incep cu "ab" (ultimul parametru) precum si cuvintele. In caz ca nu se gaseste niciunul se va afisa 0. Pentru exemplu de mai sus s-ar afisa:
Exemplu:
Cmd: "freq.exe abcd adfc albc adbc arlv ab"
Output:
Count: 1
abcd
Problema 3:
Pentru doua stringuri a si b, sa se verifice daca a este subsecventa a lui b. Se considera subsecventa a unui string, un nou string care este format din caracterele stringului original stergand unele caractere, fara sa schimbe pozitia caracterelor ramase (ex. "ace" este subsecventa a lui "abcde", dar "aec" nu este)
Problema 4:
Pentru 2 stringuri a si b sa se verifice daca a este anagrama a lui b. O anagrama este un cuvant format din literele altui cuvant, dar in alta ordine.
Lab 02 - Tuesday - 10-12
Problem 1:
For a list of numbers received as a parameter, display the sublist with the maximum sum.
Example:
Cmd: "maxsumarray.exe -2 1 -3 4 -1 2 1 -5 4"
Output: 6
Explanation: [4,-1,2,1] has the highest sum = 6.
Problem 2:
Construct a Map (dictionary) with multiple levels where each key is a letter from a word, and the value is either the next letter in the word if it exists, or the number of occurrences of that word. For "abcd" and "adcb", it would look like this:
{
"a": {
"b": {
"c": {
"d": 1
}
},
"d": {
"c": {
"b": 1
}
}
}
}
For a command line like :
"freq.exe abcd adfc albc adbc arlv ab"
display how many words start with "ab" (the last parameter) as well as the words themselves. If none is found, display 0. For the above example, it would display:
Example:
Cmd: "freq.exe abcd adfc albc adbc arlv ab"
Output:
Count: 1
abcd
Problem 3:
For two strings a and b, verify if a is a subsequence of b. A subsequence of a string is a new string that is formed by deleting some characters of the original string without changing the position of the remaining characters (e.g., "ace" is a subsequence of "abcde", but "aec" is not).
Problem 4:
For 2 strings a and b, check if a is an anagram of b. An anagram is a word formed by rearranging the letters of another word.