Skip to main content

All Questions

3 votes
1 answer
237 views

Leetcode: Number of Islands - BFS (Queue vs Recursion)

I was playing around with leetcode's Number of Islands. As per the challenge's description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the ...
ccot's user avatar
  • 361
6 votes
3 answers
465 views

Leetcode: Largest Number

I was trying out leetcode's Largest Number. As per the challenge's description: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since ...
ccot's user avatar
  • 361
4 votes
2 answers
513 views

Leetcode: Steps to Make Array Non-decreasing

I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
ccot's user avatar
  • 361
9 votes
4 answers
2k views

Leetcode : First Missing Positive

I was trying out leetcode's first missing positive. As per the challenge's description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an ...
ccot's user avatar
  • 361
2 votes
3 answers
553 views

Recursive palindrome check

I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
Yamin Siahmargooei's user avatar
1 vote
2 answers
155 views

Improving Project Euler code problem #10

So, I just finished Problem 10 on Project Euler, but it took about 3 to 4 minutes for my output to come out, due to bad coding, I guess, any suggestions on how could I optimize my code? Question The ...
fabinfabinfabin's user avatar
1 vote
2 answers
646 views

Leetcode kth largest element without using heaps

I was working on kth largest element problem on leetcode Question Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in ...
D_S_X's user avatar
  • 189
2 votes
1 answer
70 views

Molybdenum2019 challenge efficient implementation

I'm working on a solution that is correct but inefficient. https://app.codility.com/programmers/task/leader_slice_inc/ This is my code : ...
Antonio Diaz's user avatar
1 vote
1 answer
90 views

return the number of times is state of bulb changed?

Today in an exam I faced a problem which is Toggled Switches(Hacker Earth) as it is an exam question So, I am unable to send the question or its link (exactly). Problem: we have to print a number ...
chandu_reddim's user avatar
1 vote
1 answer
1k views

Follow-up: How can we optimizing Java BigInteger operations?

This is the follow up question of How can we optimizing Java BigInteger operations? Problem Reduce the number to 1 in a minimal number of steps, following the rules: ...
Anit Shrestha's user avatar
4 votes
1 answer
166 views

Find first index of 1

Given a sorted array consisting 0’s and 1’s. The task is to find the index of first ‘1’ in the given array. I submitted the below code in geeks for geeks and the execution time is 5.77. Need help in ...
learner's user avatar
  • 85
3 votes
0 answers
198 views

Count unique subsequences

I came across this question in a coding competition (Java-restricted) and I got a time-length-exceeded. I am unable to provide a link as the contest is closed now. Can I know how can I optimise this? ...
PRANATHI G's user avatar
3 votes
1 answer
280 views

LeetCode 146: LRU Cache III

I'm posting my Java code for LeetCode's LRU Cache. If you have time and would like to review, please do so. Thank you! Problem Design and implement a data structure for Least Recently Used (LRU) cache....
Emma's user avatar
  • 3,592
2 votes
0 answers
810 views

LeetCode 218: The Skyline Problem II

Here I'm posting my Java code for the skyline problem. If you have time and would like to review, please do so, I'd appreciate that. Problem A city's skyline is the outer contour of the silhouette ...
Emma's user avatar
  • 3,592
3 votes
1 answer
471 views

LeetCode 767: Reorganize String

Here I'm posting my code for the Reorganize String problem on LeetCode. If you have time and would like to review, please do so, I'd appreciate that. On LeetCode, we are only allowed to change the ...
Emma's user avatar
  • 3,592

15 30 50 per page
1
2 3 4 5
9