Skip to content

Conversation

@kamendov-maxim
Copy link
Owner

No description provided.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Технически сложно (+1 балл), но неаккуратно (-1 балл) и неправильный ответ выдаёт (-3 балла) :)

Comment on lines +22 to +24
qsort(newNumber, strlen(newNumber), sizeof(char), compare);

return newNumber;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не всё так просто. На тесте 10 правильный ответ был бы 10, а у Вас получится 01, что не является корректной записью числа в десятичной системе счисления. Причём, в тестах числа с нулём даже не рассматривались, так что ладно бы Вы неправильно поняли условие и не спросили, но тут, кажется, про это вообще не подумали :)

@@ -0,0 +1,25 @@

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя пустая строчка

@@ -0,0 +1,3 @@
#pragma once

char * getMinimalNumber(char const * const number);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Надо комментарии к каждой функции в заголовочном файле
  • И что-то тут пробелов многовато

Comment on lines +17 to +25
// int comp (const char element1, const char element2)
// {
// if (element1 == element2)
// {
// return 0;
// }

// return (element1 < element2 ? -1 : 1);
// }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Закомментированного кода в окончательной версии быть не должно.

// return (element1 < element2 ? -1 : 1);
// }

static clear(void)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static clear(void)
static int clear(void)

Comment on lines +62 to +63
free(number);
if (number == NULL)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Технически так тоже будет работать, но я бы сначала делал if, потом free

Comment on lines +77 to +91
// #include <stdio.h>
// #include <stdlib.h>

// char values[] = { 5, 4, 7, 1, 2 };

// int compare(const void *a, const void *b)
// {
// return *(const char *)a - *(const char *)b;
// }

// char arr[] = "dbaurjvgeofx";

// printf("Unsorted: %s\n", arr);
// qsort(arr, strlen(arr), 1, compare);
// printf("Sorted: %s\n", arr); No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

strcpy(copy, string);
}
return copy;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strdup

#pragma once

#include <stdbool.h>
#include <string.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это вроде как не нужно в самом .h-файле, так что можно перенести в .c

Comment on lines +21 to +26
const char * const input1 = "564353456";
const char * const answer1 = "334455566";
const char * const input2 = "5435";
const char * const answer2 = "3455";

return testCase(input1, answer1) && testCase(input2, answer2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const char * const input1 = "564353456";
const char * const answer1 = "334455566";
const char * const input2 = "5435";
const char * const answer2 = "3455";
return testCase(input1, answer1) && testCase(input2, answer2);
return testCase("564353456", "334455566") && testCase("5435", "3455");

Какие-то лишние церемонии

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants