Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
3 votes
2 answers
340 views

Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values

Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
Nate Anderson's user avatar
6 votes
3 answers
316 views

Largest Triple Products without using sort?

I implemented the Largest Triple Products algorithm, but I use sort which makes my time complexity \$O(n *log(n))\$. Is there a way to implement it without a temporary sorted array? The problem: You'...
myTest532 myTest532's user avatar
4 votes
2 answers
302 views

Maxcounters in JavaScript

I am trying to solve this question: MaxCounters. Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it ...
jackdaw's user avatar
  • 143
2 votes
1 answer
1k views

Codewars: Pick peaks

Pick peaks Wrote my "hello world" on Thursday, so definitely a beginner. I know some Python, so not a novice to programming in general. Question For example, the array ...
Tobi Alafin's user avatar
  • 1,792
-2 votes
1 answer
189 views

Challenge - Construct binary tree from array [closed]

A coding challenge to construct a binary tree from an array. ...
Drewsup123's user avatar
3 votes
2 answers
2k views

Counting Valleys - HackerRank Challenge

For this challenge on HackerRank: A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level. Given Gary's ...
HappyHands31's user avatar
8 votes
5 answers
4k views

Find The One Element In An Array That is Different From The Others

https://www.codewars.com/kata/find-the-stray-number/train/javascript I solved this challenge by sorting from least to greatest, and checking if the first element in the array matched the second ...
HappyHands31's user avatar
11 votes
5 answers
1k views

Easy to read palindrome checker

I made a palindrome checker that's supposed to be designed to be simple and easy to read. Please let me know what you think. I believe the time complexity is \$\mathcal{O}(n)\$ but I'm not too sure ...
DreamVision2017's user avatar
0 votes
3 answers
299 views

Finding nth lowest value without any Math max or min methods

So I decided to make a more efficient solution to a Google interview question where they ask you to either find the lowest or second lowest value in an array without using the max or min methods. I ...
DreamVision2017's user avatar
1 vote
2 answers
453 views

JavaScript Spiral Matrix Coding Challenge

A whiteboarding challenge: Given a 2D array (matrix) inputMatrix of integers, create a function spiralCopy that copies ...
MadHatter's user avatar
  • 855
7 votes
2 answers
3k views

Deepest pit of an array

Following is based on a problem description from a Codility test, as a task in an interview. DeepestPit - problem description A non-empty zero-indexed array B ...
James Ray's user avatar
  • 221
2 votes
1 answer
210 views

HackerRank - Left Rotation in JavaScript

I'm looking to learn more about data structures, time complexity, and efficient algorithms. I have solved the Left Rotation Problem on HackerRank using JavaScript. I am looking to see ways to optimize ...
Justin Bess's user avatar
10 votes
2 answers
700 views

Array duplicate removal for duplicates exceeding `N`-number

I recently encountered a front-end interview coding challenge question that required one to create a function which returned an array that excluded numbers that occurred more than ...
Gavin Hughes's user avatar
3 votes
3 answers
7k views

Function to find the shortest word in an array, where not every element is a string

I wrote a solution for a codeCamp exercise: Write a function called findShortestWordAmongMixedElements. Given an array, ...
Antonio Pavicevac-Ortiz's user avatar
3 votes
1 answer
5k views

Codewars "Consecutive strings" kata

The challenge description is as follows: You are given an array strarr of strings and an integer k. Your task is to return the ...
Phrancis's user avatar
  • 20.5k

15 30 50 per page