Laborator 02

Problema 1:

RO: Pentru un sir de numere date ca argumente la linia de comanda (reprezentand un intreg foarte mare), sa se construiasca o lista unde fiecare element este o cifra a acestui numar. Sa se afiseze lista corespunzatoare numarului primit ca argument, incrementat cu 1.

EN: For a sequence of numbers given as command-line arguments (representing a very large integer), construct a list where each element is a digit of this number. Display the list corresponding to the given number, incremented by 1.

Exemplu:

Cmd: "plusunu.dart 1 2 3"

Output: [1,2,4]

Cmd: "plusunu.dart 9 9 9"

Output: [1,0,0,0]

Problema 2:

RO: Se da de la tastatura un sir de litere si numere (unde fiecare numar corespunde literei anterioare) si un cuvant. Pentru cuvantul primit sa se afiseze suma numerelor, folosind valoarea corespunzatoare pentru fiecare litera din cuvant.

EN: A sequence of letters and numbers is given from the keyboard (where each number corresponds to the previous letter) along with a word. For the given word, display the sum of the numbers using the corresponding value for each letter in the word.

Exemplu:

Cmd: "wordsum.dart A 5 B 3 C 9 ABBCC"

Output: 29

Problema 3:

RO: Pentru o lista data, sa se returneze numarul de "perechi bune". O pereche (i, j) este buna daca list[i] == list[j] si i != j. Fiecare pereche va fi reprezentata printr-un set.

EN: For a given list, return the number of "good pairs." A pair (i, j) is considered good if list[i] == list[j] and i != j. Each pair will be represented as a set.

Problema 4:

RO: Se da un numar n. Fiecare numar de la 1 la n este grupat in functie de suma cifrelor sale. Sa se returneze numarul de grupuri care au cele mai multe numere.

EN: A number n is given. Each number from 1 to n is grouped based on the sum of its digits. Return the number of groups that contain the most numbers.

Exemplu 1:

Input: n = 13

Output: 4

Explicatie:
RO: Sunt 9 grupuri in total, sunt grupate in functie de suma cifrelor numerelor de la 1 la 13:   
EN: There are 9 groups in total, grouped based on the sum of the digits of the numbers from 1 to 13.

[1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9].

RO: Sunt 4 grupuri ce au cele ai multe numere.
EN: There are 4 groups that have the most numbers.

Exemplu 2:

Input: n = 30

Output: 1