Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
06d76ae
Test commit. "addition" task done
EugeniusMiroshnichenko Nov 23, 2025
613b706
Test commit not in main branch
EugeniusMiroshnichenko Nov 23, 2025
2a4d55b
Trying to start pipeline
EugeniusMiroshnichenko Nov 23, 2025
ae23b13
Char changer done
EugeniusMiroshnichenko Nov 23, 2025
ac78ed1
Check flags done
EugeniusMiroshnichenko Nov 23, 2025
6d5ca5a
Legth literals done
EugeniusMiroshnichenko Nov 23, 2025
973e2c1
RMS done
EugeniusMiroshnichenko Nov 23, 2025
70b559a
Quadratic semi-done
EugeniusMiroshnichenko Nov 23, 2025
6abdaed
Merge pull request #1 from EugeniusMiroshnichenko/01-week
EugeniusMiroshnichenko Nov 23, 2025
f232d92
Changes of char_changer/test.cpp
EugeniusMiroshnichenko Nov 23, 2025
6e33054
"std::fixed" removed
EugeniusMiroshnichenko Nov 23, 2025
5040363
Print bits done
EugeniusMiroshnichenko Nov 23, 2025
c2ecb84
Print bits done
EugeniusMiroshnichenko Nov 23, 2025
5ccfcfd
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Nov 23, 2025
d16d634
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Nov 26, 2025
b5846d2
Empty commit for pipeline
EugeniusMiroshnichenko Nov 26, 2025
3140432
Re-built
EugeniusMiroshnichenko Nov 26, 2025
491b548
Removing build and .vscode folders from repo
EugeniusMiroshnichenko Nov 26, 2025
76b88a1
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
cec01a6
Func array done
EugeniusMiroshnichenko Dec 3, 2025
54e4f93
Last of us done
EugeniusMiroshnichenko Dec 3, 2025
5a5aa8e
Longest done
EugeniusMiroshnichenko Dec 3, 2025
281a806
Overload for longest added
EugeniusMiroshnichenko Dec 3, 2025
f13237b
Pretty array done
EugeniusMiroshnichenko Dec 3, 2025
8de7695
Swap pointer done
EugeniusMiroshnichenko Dec 3, 2025
6056097
Merge remote-tracking branch 'upstream/main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
2daeaf6
Debug + little big done
EugeniusMiroshnichenko Dec 3, 2025
31e8046
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
58c3ad7
Merge branch 'main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
874bb03
Returning removed test
EugeniusMiroshnichenko Dec 3, 2025
d8dc8a0
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
f273f6e
Merge branch 'main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
38792e3
Merge pull request #3 from EugeniusMiroshnichenko/02-week
EugeniusMiroshnichenko Dec 3, 2025
8ca841e
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 16, 2025
8f13fad
Реализация
EugeniusMiroshnichenko Dec 16, 2025
bb3be57
Временно удаляем 4 неделю
EugeniusMiroshnichenko Dec 16, 2025
7cc1249
Удаляем временно 4 неделю
EugeniusMiroshnichenko Dec 16, 2025
ded273c
Enum operators done
EugeniusMiroshnichenko Dec 18, 2025
44576c4
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 19, 2025
c2a260e
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
b170ddf
Merge remote-tracking branch 'origin/main' into 03-week
EugeniusMiroshnichenko Dec 19, 2025
8c9c865
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
72dc419
Все таки удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
4d24f6e
По другому удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
12bf2b7
Удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
c8c5587
Update CMakeLists.txt
18thday Dec 19, 2025
70d105d
Merge pull request #5 from EugeniusMiroshnichenko/03-week
EugeniusMiroshnichenko Dec 19, 2025
869fe5b
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 23, 2025
c268186
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 23, 2025
fdd5565
Phasor done
EugeniusMiroshnichenko Dec 23, 2025
4132904
Queue done
EugeniusMiroshnichenko Dec 23, 2025
9f310f4
Stack done
EugeniusMiroshnichenko Dec 26, 2025
7523dc1
Ring buffer done
EugeniusMiroshnichenko Dec 26, 2025
12d57d3
Красота
EugeniusMiroshnichenko Dec 26, 2025
cd94211
Merge pull request #6 from EugeniusMiroshnichenko/04_week
EugeniusMiroshnichenko Dec 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build directories
build/
*/build/
*/build*/

# IDE
.vscode/
3 changes: 2 additions & 1 deletion 01_week/tasks/addition/addition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@


int64_t Addition(int a, int b) {
throw std::runtime_error{"Not implemented"};
int64_t result = static_cast<int64_t>(a) + static_cast<int64_t>(b);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • излишне создавать переменную
  • лишний каст, так как будет неявное приведение правого операнда, если первый int64_t, данной возможностью языка принято пользоваться и не писать лишний код

return result;
}
2 changes: 1 addition & 1 deletion 01_week/tasks/char_changer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1. Строчные латинские символы заменяются на прописные, правило 1 действует
1. Последовательные пробельные символы, заменяются на один без указания числа
повторений и преобразуются в заданный извне разделитель `delimeter`.
1. Все остальные символы заменяются на символ `_`
1. Все остальные символы заменяются на символ `_`. Правило 1 действует

Гарантируется, что последний символ в массиве `'\0'`.

Expand Down
74 changes: 73 additions & 1 deletion 01_week/tasks/char_changer/char_changer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,79 @@
#include <cstddef>
#include <stdexcept>
#include <cctype>


size_t Counter(char array[], size_t size, size_t startIdx){
char symbol = array[startIdx];
size_t count = 1;
for (size_t i=startIdx+1; i<size-1; ++i){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

пробелы вокруг всех бинарных операторов и перед {

if (array[i] == symbol) ++count;
else break;
}
return count;
}

size_t CharChanger(char array[], size_t size, char delimiter = ' ') {
throw std::runtime_error{"Not implemented"};
char result[256];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

это излишнее потребление памяти, можно обойтись без массива, к тому же не было ограничения на 256 символов последовательности

size_t count = 0;
size_t new_ar_pos = 0;
for (size_t i=0; i<size-1;){
count = Counter(array, size, i);

if (array[i] == ' '){
result[new_ar_pos] = delimiter;
}
else if (array[i] >= +'0' && array[i] <= +'9'){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

поскольку array это массив char, то непонятно зачем унарный плюс перед символом

result[new_ar_pos] = '*';
if (count >= 10){
++new_ar_pos;
result[new_ar_pos] = '0';
}
else if (count > 1){
++new_ar_pos;
result[new_ar_pos] = count + '0';
}
}
else if (array[i] >= +'a' && array[i] <= +'z'){
result[new_ar_pos] = std::toupper(array[i]);
if (count >= 10){
++new_ar_pos;
result[new_ar_pos] = '0';
}
else if (count > 1){
++new_ar_pos;
result[new_ar_pos] = count + '0';
}
}
else if (array[i] >= +'A' && array[i] <= +'Z'){
result[new_ar_pos] = array[i];
if (count >= 10){
++new_ar_pos;
result[new_ar_pos] = '0';
}
else if (count > 1){
++new_ar_pos;
result[new_ar_pos] = count + '0';
}
}
else{
result[new_ar_pos] = '_';
if (count >= 10){
++new_ar_pos;
result[new_ar_pos] = '0';
}
else if (count > 1){
++new_ar_pos;
result[new_ar_pos] = count + '0';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Очень много дублирования кода, стоит реорганизовать код так, чтобы не было дублирования
Также есть стандартные функции для определения является ли символ цифрой, буквой, лучше использовать их, поскольку у них понятные названия нежели кастомные условия

}
i += count;
++new_ar_pos;
}
for (size_t i = 0; i < new_ar_pos && i < size - 1; ++i) {
array[i] = result[i];
}
array[std::min(new_ar_pos, size - 1)] = '\0';
return new_ar_pos;
}

25 changes: 24 additions & 1 deletion 01_week/tasks/check_flags/check_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,28 @@ enum class CheckFlags : uint8_t {
};

void PrintCheckFlags(CheckFlags flags) {
throw std::runtime_error{"Not implemented"};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

uint8_t flags_int = static_cast<uint8_t>(flags);
if (flags_int > static_cast<uint8_t>(CheckFlags::ALL)) {
std::cout << "";
return;
}

std::string names[6] = {"TIME", "DATE", "USER", "CERT", "KEYS" , "DEST"};
std::string result = "[";
bool symbol_added = false;

uint8_t mask = 1;
for (size_t i = 0; i < 6; ++i) {
mask = (1 << i);
if (flags_int & mask) {
if (symbol_added) {
result += ",";
}
result += names[i];
symbol_added = true;
}
}

std::cout << result + "]";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

хорошее решение задачи

}
47 changes: 47 additions & 0 deletions 01_week/tasks/length_lit/length_lit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
constexpr double operator""_m_to_cm(long double meters){
return meters * 100;
}

constexpr double operator""_cm_to_m(long double centimeter){
return centimeter / 100.0;
}

constexpr double operator""_ft_to_m(long double feets){
return feets * 0.3048;
}

constexpr double operator""_ft_to_cm(long double feets){
return operator""_m_to_cm(operator""_ft_to_m(feets));
}

constexpr double operator""_ft_to_in(long double feets){
return feets * 12.0;
}

constexpr double operator""_in_to_m(long double inches){
return inches * 0.0254;
}

constexpr double operator""_in_to_cm(long double inches){
return operator""_m_to_cm(operator""_in_to_m(inches));
}

constexpr double operator""_in_to_ft(long double inches){
return inches / 12.0;
}

constexpr double operator""_m_to_ft(long double meters){
return meters * 3.280839895;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

В коде не принято оставлять magic value, в данном месте лучше использовать выражения.
В данной задаче напрашивается безымянный namespace с константами 2.54, 0.3048, 12, а значение 100 можно использовать в коде

}

constexpr double operator""_m_to_in(long double meters){
return meters * 39.37007874;
}

constexpr double operator""_cm_to_ft(long double centimeters){
return operator""_cm_to_m(operator""_m_to_ft(centimeters));
}

constexpr double operator""_cm_to_in(long double centimeters){
return operator""_cm_to_m(operator""_m_to_in(centimeters));
}
16 changes: 15 additions & 1 deletion 01_week/tasks/print_bits/print_bits.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#include <cstddef>
#include <stdexcept>
#include <iostream>


void PrintBits(long long value, size_t bytes) {
throw std::runtime_error{"Not implemented"};
std::string result = "0b";
size_t total_bits = bytes * 8;
long long mask = 0LL;
// Тут надо int, иначе условие бесконечное, потому что будет
Copy link
Contributor Author

Choose a reason for hiding this comment

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

все зависит от условия и действий, но можно и с int

// происходит переполнение счетчика
for (int i = total_bits - 1; i >= 0; --i) {
mask = 1LL << i;

if (value & mask) result += '1';
else result += '0';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

как будто громоздкая конструкция, ещё и наверняка не попадет в style guide, в данном случае по условию решается прибавлять 0 или 1, поэтому тернарный оператор подойдет отлично


if (i % 4 == 0 && i != 0) result += '\'';
}
std::cout << result << "\n";
}
60 changes: 59 additions & 1 deletion 01_week/tasks/quadratic/quadratic.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,64 @@
#include <stdexcept>
#include <cmath>
#include <iomanip>
#include <iostream>

bool isLevelLine(int a, int b){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

нужен пробел перед {

if (a == 0 && b == 0) return true;
else return false;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

лишняя строка

}

bool isLinear(int a, int b){
if (a == 0 && b != 0) return true;
else return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

очень сомнительная конструкция, если true то верни true, иначе (если false) верни false
просто вернуть результат выражения


}

bool isQuadratic(int a){
if (a != 0) return true;
else return false;

}

std::string AddRootToStr(double x){
std::ostringstream oss;
oss << std::setprecision(6);
if (std::abs(x - std::round(x)) < 1e-10) {
oss << static_cast<int>(std::round(x));
} else {
oss << x;
}
return oss.str();
}

void SolveQuadratic(int a, int b, int c) {
throw std::runtime_error{"Not implemented"};
std::string result = "";
if (isLevelLine(a, b)){
if (c == 0) result = "infinite solutions";
else result = "no solutions";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

две строки некрасивой конструкции, вместо одной

}
else if (isLinear(a, b)){
double x = -static_cast<double>(c) / b;
result = AddRootToStr(x);
}
else if (isQuadratic(a)){
double discr = b * b - 4 * a * c;
if (discr < 0) {
result = "no solutions";
}
else if (std::abs(discr) < 1e-10) {
double x = -b / (2.0 * a);
result = AddRootToStr(x);
}
else {
double x1 = (-b + sqrt(discr)) / (2.0 * a);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

std::sqrt

double x2 = (-b - sqrt(discr)) / (2.0 * a);

if (x1 > x2) std::swap(x1, x2);
result = AddRootToStr(x1) + " " + AddRootToStr(x2);
}
}

std::cout << result;
}
11 changes: 8 additions & 3 deletions 01_week/tasks/rms/rms.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include <cstdef>
#include <stdexcept>
#include <cstddef>
#include <cmath>


double CalculateRMS(double values[], size_t size) {
throw std::runtime_error{"Not implemented"};
double res = 0.0;
if (values == nullptr || size == 0) return res;
for (size_t i=0; i < size; ++i){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

нет пробелов вокруг оператора =

res += values[i] * values[i];
}
return std::sqrt(res / size);
}
12 changes: 10 additions & 2 deletions 02_week/tasks/func_array/func_array.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include <stdexcept>


double ApplyOperations(double a, double b /* other arguments */) {
throw std::runtime_error{"Not implemented"};
double ApplyOperations(double a, double b, double (*functions[])(double, double), size_t func_count) {
double result = 0.0;
const double& a_ref = a;
const double& b_ref = b;
for (size_t i=0; i<func_count; ++i){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

нет проблеов вокруг бинарных операторов

if (functions[i]){
result += functions[i](a_ref, b_ref);
}
}
return result;
}
17 changes: 15 additions & 2 deletions 02_week/tasks/last_of_us/last_of_us.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#include <stdexcept>


/* return_type */ FindLastElement(/* ptr_type */ begin, /* ptr_type */ end, /* func_type */ predicate) {
throw std::runtime_error{"Not implemented"};
const int* FindLastElement(const int* begin, const int* end, bool (*predicate)(int)) {
const int* result = end;
if ((begin == nullptr) || (end==nullptr) || (predicate == nullptr) || (begin > end)){
result = end;
return result;
}

for (; begin != end; ++begin){
const int elem = *begin;
if (predicate(elem)){
result = begin;
}
}

return result;
}
26 changes: 22 additions & 4 deletions 02_week/tasks/little_big/little_big.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>

void PrintingFunc(unsigned char* byte_ptr, size_t bytes, bool shouldInverse){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Общепринято использовать present simple в названиях и глагол PrintFunc

std::ostringstream oss;
oss << "0x";

for (size_t i = 0; i < bytes; ++i) {
size_t index = shouldInverse ? (bytes - 1 - i) : i;
oss << std::hex << std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(byte_ptr[index]);
}

oss << "\n";
std::cout << oss.str();
}

void PrintMemory(int /* write arguments here */) {
throw std::runtime_error{"Not implemented"};
void PrintMemory(int number, bool shouldInverse=false) {
unsigned char* byte_ptr = reinterpret_cast<unsigned char*>(&number);
PrintingFunc(byte_ptr, 4, shouldInverse);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

некорректно явно указывать количество байт, это платформозависимый код, sizeof для этого необходимо использовать

}

void PrintMemory(double /* write arguments here */) {
throw std::runtime_error{"Not implemented"};
void PrintMemory(double number, bool shouldInverse=false) {
unsigned char* byte_ptr = reinterpret_cast<unsigned char*>(&number);
PrintingFunc(byte_ptr, 8, shouldInverse);
}
Loading