Skip to content

Instantly share code, notes, and snippets.

@Tokiyomi
Tokiyomi / equalsum.py
Created October 21, 2022 21:57
powers of two in python
# Python Solution
def powers_of_two(N):
"""
This function generates my proposed tactical N sets of numbers made of powers of 2
and the remaining N-30 numbers will be the last N numbers before 10**9 inclusive.
As N is always 100, this fuction is always performed without problems
"""
A = [2**i for i in range(30)] + [10**9 - n for n in range(N-30)]
@Tokiyomi
Tokiyomi / powers_of_two.kt
Last active October 21, 2022 21:55
Generate a list of powers of two in Kotlin
// Kotlin solution
fun powers_of_two(N:Int):MutableList<Long> {
/*
This function generates a tactical N set of numbers made of powers of 2
and the remaining N-30 numbers will be the last N numbers before 10**9 inclusive.
As N is always 100, this fuction is always performed without problems
*/
var A = mutableListOf<Long>() // Open empty list
@Tokiyomi
Tokiyomi / equalsum.cs
Last active October 21, 2022 21:48
Equal sum solution in C#
// Code Jam Individual Problem - Equal Sum - Carolina Garma
// Prev knowledge: binary representation, partitions
using System;
using System.Collections.Generic;
using System.Linq;
namespace GoogleJam
{
class EqualSum