Conversation
Owner
shknoko
commented
Dec 12, 2025
- Balance of brackets checker
- substring count
- zero elements count
- removed logic from main
- Brackets checker
- Removed logic from main
- changed return type
- removed pointers in functions
- List implementation
- Added printList, extended indexOf and isEmpty
- Sorted list program
- Rewrited with switch
- Circular list implementation
- Josephus problem
- Fixed circularList.h
- Fixed condition
- Updated .gitignore
- Fixed codestyle
- Refactored sortedList
- Refactored josephusProblem
- Removed redundant condition
- Added newline character in printf
- Added CMakeLists
ItIsMrLaG
suggested changes
Dec 16, 2025
| } else if (string[i] == ')') { | ||
| balance--; | ||
| if (balance < 0) { | ||
| result = false; |
There was a problem hiding this comment.
Мб стоило поставить break (true никогда не появится)
| int n = 0; | ||
| scanf("%d\n", &n); | ||
|
|
||
| char* input = calloc(n + 1, sizeof(char)); |
Comment on lines
+38
to
+40
| bool result = true; | ||
|
|
||
| result = bracketsChecker(input); |
There was a problem hiding this comment.
Suggested change
| bool result = true; | |
| result = bracketsChecker(input); | |
| bool result = bracketsChecker(input); |
| int counter = 0; | ||
| scanf("%d\n", &n); | ||
|
|
||
| int *array = malloc(n * sizeof(int)); |
There was a problem hiding this comment.
- нет проверки (
!array) - почему не calloc
| } | ||
|
|
||
| break; | ||
| case 3: |
| int indexOf(List* list, int data, unsigned* res) | ||
| { | ||
| if (list == NULL || res == NULL) { | ||
| return 2; |
There was a problem hiding this comment.
коды возврата лучше завернуть в define
Comment on lines
+18
to
+19
| List* newList = calloc(1, sizeof(List)); | ||
| return newList; |
There was a problem hiding this comment.
Suggested change
| List* newList = calloc(1, sizeof(List)); | |
| return newList; | |
| return calloc(1, sizeof(List)); |
| int isEmpty(List* list) | ||
| { | ||
| if (list == NULL) { | ||
| return 2; |
There was a problem hiding this comment.
Почему isEmpty не true или false, а 2... (ну и как минимум в define бы)
| return false; | ||
| } | ||
|
|
||
| List* list = newList(); |
| int n = 0, m = 0; | ||
| scanf("%d%d", &n, &m); | ||
|
|
||
| int res = -1; |
There was a problem hiding this comment.
зачем выставлять в -1, если josephus()=true перезапишет res, а josephus()=false не дойдет до printf где используется res?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.