Stack and Queue Challenges Comments


  • my code

    I'm not sure how I'm supposed to restart the current min and set it to 7. Basically if i pop a bunch off and the new min is a bigger number it is still showing the current min i set from before. Any hints on what I'm doing wrong?

  • So, how do I know if all my operations are correctly running at O(1)? I mean, I can say it in theory but do the platform perform any basic check? Doesn't looks like because any code I wrote the test is passing.

  • @Paulo, currently you should analyze the running time on your own. The computer cannot check the running time, but in the future we may add larger tests cases that fail to complete in time for poor algorithms.

  • I still don't know exactly what I'm doing wrong...

  • would it be easier to use a queue here?

  • Hint: Constant running time, but not constant space complexity

  • Please a hint. i cant figure it out. I keep sitting with an empty stack and other problems. Help.

  • I have fount a way, but i think its not really the good way. can i see a featured awnseranywere?

  • Here's a possible solution.

  • Would have been nice if the system didn't think my solution was wrong just because I forgot to println() after each example. Otherwise, keep up the good work!

  • i write the program in Big O O(1) .how i can see my extra credit score.

  • All correct answers get the same mark, but it's a personal challenge to see if you can get a good Big-O time.

  • Good time of day Admins .
    I have a question - how can I use Stack or Queue for this challenge ? Or it is not necessary?

  • The simple optimal solution uses a queue, but you can also use less optimal solutions (with a longer running time).

  • Why there is no cheat available for the problems?

  • This one worked, wdyt?

    public static void doStuff(String text){
    Stack stack = new Stack<>();

        for (int i = 0; i < text.length(); i++) {
  • good challenge, so glad to have got it! :)

  • Does this really require a stack? If you make the observation that each level in the level order representation has 2n - 1 nodes (including zeros), where n is the number of the tree

  • 2n - 1 in my previous comment. Tried to use superscript in markdown, didn't work

  • @Panashe, that's true with the current input format, but for the full challenge you should assume you're just given the tree nodes without an array.

Contact Us
Sign in or email us at [email protected]