C
C#15mo ago
AceChewy

❔ LeetCode Alternatives

Leetcode is quite difficult to navigate at times as some questions are not correctly labelled in terms of difficult and sometimes require you to have done other problems before attempting it even though the problem comes first. And so, I was hoping whether anyone knew of any other websites which support C# but are a bit more linear. (I've had similar experiences with exercism but not too the same extent
16 Replies
Shinigami
Shinigami15mo ago
I'd suggest go through neetcode.io, which has problems based on data structures maybe just try going through only array problems, learn the concepts of array like adding elements, removing elements , traversing the array etc... as you go through the problems you use more datatypes like Dictionary for example to solve an array question for optimization I always felt problems on exercism assumes you know stuff before solving them, it's kinda difficult for a beginner to follow through exercism
AceChewy
AceChewyOP15mo ago
I'm pretty sure neetcode doesn't support c# though?
Shinigami
Shinigami15mo ago
it does neetcode has C# solutions and neetcode directs you to leetcode to solve the problems, you can easily find C# solutions in leetcode
AceChewy
AceChewyOP15mo ago
Ah ok, that's cool then
Shinigami
Shinigami15mo ago
if you want someone to solve problems with you can hit me up
AceChewy
AceChewyOP15mo ago
Ok, thank you I'll probably try doing 2~ problems a day so expect me to take full advantage if I'm stuck
Shinigami
Shinigami15mo ago
sure sure
AceChewy
AceChewyOP15mo ago
Here's some code checking if an element in an array is a duplicate :
public class Solution
{
public bool ContainsDuplicate(int[] nums)
{
HashSet<int> set = new HashSet<int>();
foreach (int num in nums)
{
if (set.Contains(num))
{
return true;
}
set.Add(num);
}
return false;
}
}
public class Solution
{
public bool ContainsDuplicate(int[] nums)
{
HashSet<int> set = new HashSet<int>();
foreach (int num in nums)
{
if (set.Contains(num))
{
return true;
}
set.Add(num);
}
return false;
}
}
Can I make it more memory efficient by making the size of the hash set eqaul to the size of the array?
Shinigami
Shinigami15mo ago
This looks good Afaik it won't make much of a difference
AceChewy
AceChewyOP15mo ago
Ah ok, this just bothers me slightly
No description
Shinigami
Shinigami15mo ago
I'd suggest, you solve it and if the code works check the video solution and see what you missed and what approach you could have taken Remember the approach for future questions This is not your code fault It's leetcodes backend I think they use mono and it takes more time that it should
AceChewy
AceChewyOP15mo ago
Sounds like a good idea
Shinigami
Shinigami15mo ago
Same code if you run it in java, it'll take 1 ms Don't worry too much about that
AceChewy
AceChewyOP15mo ago
Cool, thanks
nohopestage
nohopestage15mo ago
I like codewars
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server