07 Company Users Exercise JavaScript Associative Arrays
Здравейте,
Имам проблем с една от задачите за домашно. Нулевите тестове минават, но Judge ми дава 60/100 и не мога да си открия грешката.
Може ли някой да провери? Предварително благодаря!
07.Company Users
Write a function which keeps information about companies and their employees.
You will receive array of strings containing company name and employee's id. Add each employee to the given company. Keep in mind that a company cannot have two employees with the same id.
When you finish reading data, order the companies by the name in ascending order.
Print the company name and each employee's id in the following format:
{companyName}
-- {id1}
-- {id2}
-- {idN}
Input / Constraints
- The input come as array of strings, each in the format: "{companyName} -> {employeeId}".
- The input always will be valid.
Examples
Input |
Output |
|
Input |
Output |
[ 'SoftUni -> AA12345', 'SoftUni -> BB12345', 'Microsoft -> CC12345', 'HP -> BB12345' ] |
HP -- BB12345 Microsoft -- CC12345 SoftUni -- AA12345 -- BB12345 |
|
[ 'SoftUni -> AA12345', 'SoftUni -> CC12344', 'Lenovo -> XX23456', 'SoftUni -> AA12345', 'Movement -> DD11111' ] |
Lenovo -- XX23456 Movement -- DD11111 SoftUni -- AA12345 -- CC12344 |
Много благодаря!
даже направо ги пази в сет, по-оптимално работи: