Skip to main content
2 votes
1 answer
107 views

I was just trying to implement cyclic sort after watching the theory part of a YouTube video (https://youtu.be/JfinxytTYFQ?list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&t=889). I came up with the below ...
Nishanth K N's user avatar
7 votes
1 answer
367 views

I came across LeetCode problem 137. Single Number II: Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and ...
Gopika J's user avatar
  • 101
2 votes
1 answer
4k views

I am trying to solve this code challenge: Given an array arr of n integers, in a single operation, one can reduce any element of the array by 1. Find the minimum number of operations required to ...
systummm's user avatar
-3 votes
1 answer
80 views

I'm going out of bounds somewhere while iterating a very long string but I can't seem to find out where? import java.util.*; public class Solution { //Helper function to reverse words in string ...
hedgein's user avatar
2 votes
1 answer
64 views

I'm working on a project where I need to find the longest increasing subsequence (LIS) from a given array of integers. However, the array can be quite large, so I'm looking for an efficient algorithm ...
Navodya Vidumini's user avatar
0 votes
0 answers
64 views

I am a math student and I have been asked to help grade answer sheets for an Algorithms course as one of my professors is unwell. While I am quite familiar with combinatorial algorithms, I am not well ...
Umesh Shankar's user avatar
0 votes
3 answers
199 views

I attempted to solve the problem at this HackerRank link (https://www.hackerrank.com/challenges/diagonal-difference/problem?isFullScreen=true) Given a square matrix, calculate the absolute difference ...
Mário Alfredo Jorge's user avatar
-1 votes
1 answer
188 views

#include <iostream> using namespace std; const int TMAX = 2000000; int num_chupiguays(const int a[], int n) { int suma = 0; int resul = 0; for (int i = 0; i < n; i++) { ...
Ola's user avatar
  • 13
0 votes
2 answers
81 views

Let's say I have 2 arrays each of which holds a few different objects class Object1 {} class Object2 {} class Object3 {} class Object4 {} class Object5 {} class Object6 {} const arrayA = [ new ...
Charlie Martin's user avatar
0 votes
1 answer
137 views

I have written a function that makes an array unique, but I don't quite understand how the time complexity works here. Here's my whole program: #include <stdio.h> #include <stdlib.h> #...
krotovukha's user avatar
-1 votes
2 answers
82 views

public int removeMin(Integer[] arr, int count) { Integer[] tempArr = new Integer[arr.length -1]; int index = 0; for (int i = 1; i<arr.length; i++) { tempArr[index] = arr[i] ...
ansh87's user avatar
  • 3
1 vote
0 answers
64 views

For one of my assignment, I am asked to implement a radix sort algorithm. Here is the code that was written so far: class RadixSort: def __init__(self): self.base = 7 self....
Sakops's user avatar
  • 34
0 votes
1 answer
315 views

You are given two arrays each with n integers. Find the maximum sum of two elements. You have to choose one element from the first array, one element from the second array and their indexes have to be ...
Tomek Swiecki's user avatar
0 votes
1 answer
190 views

I am new to algorithms and data structures. Thus, I joined LeetCode to improve my skills. The first problem is to propose an algorithm whose time complexity is less than O(n^2). I used the code ...
Ne2j's user avatar
  • 3
1 vote
1 answer
85 views

I have a List and Map as below, val exampleList = List("A","B","C","D","E","A","L","M","N") val exampleMap = ...
Hima_93's user avatar
  • 51

15 30 50 per page
1
2 3 4 5
22