Skip to main content

All Questions

Tagged with
5votes
4answers
2kviews

Automate the boring stuff with python - Character picture grid

Character Picture Grid Say you have a list of lists where each value in the inner lists is a one-character string, like this: ...
Jarne Vercruysse's user avatar
6votes
7answers
14kviews

Hacker rank 30 days of code Maximum Sum of Hourglass

I came up with this code as a solution to a contest question. The original question can be viewed here for attribution sake: Hackerrank 2d array problem Sample input is like this: ...
ananth vankipuram's user avatar
0votes
1answer
36views

Mangle words to bytearray of lo/hibytes

I would like to refactor the following code snippet adapted from a project I'm involved. It is part of a code to control power outlets via network. The code snippet was written by myself based on the ...
Looser User's user avatar
3votes
1answer
848views

Divide array into three disjoint sets with equal sum

Problem definition : Array partition problem Given an array of positive integers, divide it into three disjoint subsets having equal sum. These disjoint sets cover the complete array. Example Input: [...
nkvns's user avatar
8votes
2answers
776views

Optimize function that returns length of a subarray

I did an exercise today on where the task is to write a function that returns the length of the longest subarray where the difference between the smallest and biggest value in the subarray is no more ...
hopla's user avatar
2votes
2answers
79views

Send an array of files and return the first one that exists

I have a little project, chuy, which is basically a copy of Make. By request of users I have added support for toml configuration, since originally it only accepted ...
Eliaz Bobadilla's user avatar
11votes
3answers
4kviews

Students with second lowest grade

I solved the Nested List Python challenge on HackerRank.com passing all test cases. Although this problem can likely be solved with a short script with clever one-liners, my approach was instead to ...
Phrancis's user avatar
7votes
3answers
4kviews

python (optimizing) bubble sort

I saw in Wikipedia (the first under Optimizing bubble sort) a pseudo-code to bubble sort and I implemented it in Python. I am posting my implementation here because I'm new to Python, and I'm looking ...
sheldonzy's user avatar
3votes
2answers
537views

Multiplying numpy arrays

I have written a function to multiply two numpy arrays. ...
GalacticPonderer's user avatar
4votes
1answer
105views

Dataframe transformation to numpy ndarray takes ages to complete

I would like to transform my dataframe into an array of fixed-sized chunks from each unique segment. Specifically, I would like to transform the ...
super_ask's user avatar
2votes
1answer
839views

Re-implementing an Array Class in Python

I gave an attempt at reinventing the wheel and recreate list methods using my own Array Class to broaden my understanding about lists. I would like advice regarding efficiency, and in implementing ...
Anonymous's user avatar
3votes
3answers
657views

Given an array, find all its elements that can become a leader

I was successful in solving a challenge in codility, but my solution failed performance tests. How can I improve my solution? Challenge: Integers K, M and a non-empty array A consisting of N ...
Harith's user avatar
5votes
1answer
352views

Applying gaussian blur on RGBA images

I designed the code and it works quite well for images of lower res. However my program takes a lot of time and ram to display higher res images (occupies 2GB RAM for 4k images and takes 20 minutes). ...
AkashdeepKar's user avatar
2votes
1answer
373views

Dice roller - python

I am about to graduate with my Associates degree in Math and will soon go for my bachelors. I've decided with two years of school left its best if I start learning to program. I am starting with ...
JeremiahV's user avatar
0votes
2answers
741views

Find the maximum value of | Ai - Aj | + | i - j |: [closed]

hackerearth.com practice problem Can you solve it?: Given an array 'A' consisting of 'n' integers, find the maximum value of the following expression: \$\lvert A_i - A_j\rvert + \lvert i - j\rvert\...
Madhuraank B's user avatar

153050per page
close