#include <seth>
2 subscribers
41 photos
9 videos
5 files
212 links
🔙 GET AWAY
Download Telegram
#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/

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. Шикарный текст и видеоряд - я прям каждую смену кадра ставил на паузу, чтобы вчитаться - создатели очень точно и иронично передали современный корпоративный вайб на оптимизацию через ИИ.

Отличный способ хорошо посмеяться в начале выходных