#include <seth>
https://leetcode.com/problems/score-of-parentheses/ int scoreOfParentheses (char *s) { int score = 0; for (int i = 0, d = 0; s[i]; ++i) { d += ((s[i] == '(') - (s[i] == ')')); score += (s[i] == ')' && s[i - 1] == '(') ? (1 << d) : 0; } return…
https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/
#leetcode #c
int minAddToMakeValid(char* s) {
int d = 0, x = 0;
for (int i = 0; s[i]; ++i) {
d += ((s[i] == '(') - (s[i] == ')'));
x += d < 0;
d &= ~((d) >> 31);
}
return d + x;
}#leetcode #c
Forwarded from Lobste.rs
Forwarded from кружочек (Андрей Рябичев)
YouTube
Василий Ионин (ПОМИ), «О некоторых задачах из теории кос»
доклад 7 октября 2026.
анонс https://t.me/kruzhochek179/1060
Теория кос — один из самых наглядных разделов математики, находящийся на пересечении алгебры и топологии. Интуитивно коса — это переплетение фиксированного числа верёвок, концы которых закреплены…
анонс https://t.me/kruzhochek179/1060
Теория кос — один из самых наглядных разделов математики, находящийся на пересечении алгебры и топологии. Интуитивно коса — это переплетение фиксированного числа верёвок, концы которых закреплены…
#include <seth>
https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/ int minAddToMakeValid(char* s) { int d = 0, x = 0; for (int i = 0; s[i]; ++i) { d += ((s[i] == '(') - (s[i] == ')')); x += d < 0; d &= ~((d) >> 31); } return d + x;…
https://leetcode.com/problems/sum-of-squares-of-special-elements/
#leetcode #c
int sumOfSquares(int* a, int n) {
int x = 0;
for (int i = 0; i < n; ++i)
x += !(n % -~i) * a[i] * a[i];
return x;
}#leetcode #c
#include <seth>
https://leetcode.com/problems/sum-of-squares-of-special-elements/ int sumOfSquares(int* a, int n) { int x = 0; for (int i = 0; i < n; ++i) x += !(n % -~i) * a[i] * a[i]; return x; } #leetcode #c
https://leetcode.com/problems/apply-operations-on-array-to-maximize-sum-of-squares/
#leetcode #c
const long long MOD = 1000000007LL;
int maxSum(int* nums, int numsSize, int k) {
int count[30] = {0};
for (int i = 0; i < numsSize; ++i)
for (int j = 0; j < 30; ++j)
count[j] += (nums[i] >> j) & 1;
int x = 0;
for (int i = 0; i < k; ++i) {
long long y = 0;
for (int j = 0; j < 30; ++j)
if (count[j]) {
y |= (1LL << j);
--count[j];
}
x = (x + y * y) % MOD;
}
return x;
}
#leetcode #c
Forwarded from Илья Шишков: код, собесы, IT (Илья Шишков)
YouTube
LGTM (Looks Good to Me) - Claude Opus 5.5 music video
LGTM stands for "looks good to me". Lately it's what engineers type on code they never had time to read, because leadership heard AI makes everyone ten times faster and cut the deadlines to match. Review and testing are the first things to go, since neither…
Очень смешная и весёлая песня на злобу дня про то, как всех заменит ИИ. Наткнулся случайно на просторах YouTube. Шикарный текст и видеоряд - я прям каждую смену кадра ставил на паузу, чтобы вчитаться - создатели очень точно и иронично передали современный корпоративный вайб на оптимизацию через ИИ.
Отличный способ хорошо посмеяться в начале выходных
Отличный способ хорошо посмеяться в начале выходных