Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
1 answer
82 views

Array Math to Calculate Ice Thickness -- Need Help Simplifying

I posted this on Stack but since it's working code, it was suggested I post it here. I wrote this code to calculate ice thickness using the following equation from Stephenson, 2011. It's a daily ...
emmahaggerty's user avatar
1 vote
1 answer
64 views

Optimizing the Dig Pow function

I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
TAHER El Mehdi's user avatar
2 votes
2 answers
811 views

Finding distance between vectors of matrices

So here is the problem: Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m respectively and one natural number 'p'. You need to find the distance(Euclidean) of the rows of the matrices 'a' and ...
Levon Avetisyan's user avatar
4 votes
1 answer
333 views

Simulated annealing for magic square-of-squares puzzle

I'm working on a function that takes in a NumPy array containing only mutually distinct positive square numbers. I want the function to pick an element at random, find if there is a lower positive ...
Galen's user avatar
  • 157
2 votes
1 answer
2k views

Menu driven program to represent polynomials as a data structure using arrays

Write a menu-driven program to represent Polynomials as a data structure using arrays and write functions to add, subtract and multiply two polynomials; multiply a polynomial with a constant, find ...
In78's user avatar
  • 663
5 votes
1 answer
266 views

Optimising Funny Marbles

Problem statement is at http://www.codechef.com/DEC13/problems/MARBLEGF Lira is given array A, which contains elements between 1000 and 2000. Three types of queries can be performed on this array: ...
user2369284's user avatar
30 votes
3 answers
83k views

Find all subsets of an int array whose sums equal a given target

I am trying to implement a function below: Given a target sum, populate all subsets, whose sum is equal to the target sum, from an int array. For example: Target ...
Mengjun's user avatar
  • 403
2 votes
1 answer
17k views

Testing if numbers in the array can be added up to equal the largest number in the array

Okay, here's a challenge at Coderbyte that completely stumped me. I came up with a solution, but I know it is flawed. Have the function ArrayAdditionI(arr) take ...
Nathan's user avatar
  • 127
6 votes
2 answers
10k views

Finding greatest value in array smaller than x

Code review requested to make this code simpler, cleaner, and better. Input array is sorted. This program finds the greatest number smaller than x. So, in an ...
JavaDeveloper's user avatar
4 votes
0 answers
306 views

Summing 2D NumPy array by multiple labels [closed]

Each element of the array is a coordinate (x, y). Each coordinate has two labels. Goal: sum the elements that have the same two labels. How can this ...
Bystander's user avatar