Welcome New Users! Please read this before posting!


  • 30

     

    Welcome to Discuss! Before you create a new topic, please read the instructions to format your code properly.

     


    Formatting your code:

     

    To format your code, surround your code block with 3 backquote signs:

    ```
    your code block
    ```
    

    will be rendered as:

    your code block
    

    PS: Note that it is 3 backquotes (just below the ESC in the keyboard), not 3 single quotes ''' (left of the ENTER in the keyboard).

     


    Posting a question / solution related to OJ problems:

     

    1. First, navigate to the correct OJ subcategory, you can do it in two ways:

      a. Go to the OJ problem page and click on the green Discuss button.

      0_1470139443835_Screen Shot 2016-08-02 at 4.34.44 AM.png

      b. Or, you can go to the OJ category page, and choose the correct problem from the subcategories list.

      0_1470137524664_Screen Shot 2016-08-02 at 4.25.27 AM.png

    2. Click on the New topic button to start posting!

      0_1470138922042_Screen Shot 2016-08-02 at 4.47.52 AM.png

     


    Posting a new interview question:

     

    Rules of a new interview question:

    1. It must not be a duplicate of an interview question found here. System design / database / shell interview questions are welcomed!

    2. Each question must have complete problem description without ambiguity.

    3. Each question should be accompanied by at least one example. The more the better.

    4. Please enter the company name in the tags shown below which will help us more effectively to organise them and push them to the shelf quickly.

      0_1461686784756_Screen Shot 2016-04-25 at 2.10.50 AM.png


  • 1
    H

    got it. Thanks!


  • 0
    X

    Got it. It's very helpful!

    Hello world
    

  • 2
    H

    Nice!

    print 'Hello World'
    

    Aha!


  • 0
    T

    public class Solution {
    public int wiggleMaxLength(int[] nums) {
    if (nums == null || nums.length <= 1)
    return nums == null ? 0 : nums.length;
    return Math.max(help(1, nums), help(-1, nums));
    }

    public int help(int flag, int[] nums) {
        int maxLength = 1;
        for (int i = 0; i + 1 < nums.length; i++) {
            if ((nums[i] - nums[i + 1]) * flag < 0) {
                maxLength++;
                flag *= -1;
            }
        }
        return maxLength;
    }
    

    }


  • 0
    I
    hello world!
    

    Got it!


  • 1
    K

    Got it, thx!

    public class Main {
      public static void main(String[] args) {
        System.out.println("Hello leetcode discuss!");
      }
    }
    

  • 0
    S

    Got it, Thx!


  • 1
    P

    You can use Markdown to write your own blogs as well. It's simple and beautiful. Check out the 10 minute tutorial here


  • 0
    Z
    System.out.println("Hello World!")
    

    Nice!


  • 0
    F

    test

    print("hello word");
    

    test end


  • 0
    J

    thanks ...,very cool


  • 0
    A

    Thank you, now I got it.


  • 0
    S

    Good

    Not Hello World
    

  • 0
    C
    public class()
    your code block
    
    

  • 0
    P

    Great!

    class Solution {
    public:
        void flatten(TreeNode* root) {
        	if (!root) return;
            TreeNode *left = root->left;
            TreeNode *right = root->right;
            root->left = root->right = nullptr;
            if (left) {
            	flatten(left);
            	root->right = left;
            }
            if (right) {
            	flatten(right);
            	while (root->right) root = root->right;
            	root->right = right;
            }
        }
    };
    

  • 0
    F
    alert('Helloworld');
    

  • 0
    B
    print("Hello World");
    

  • 0
    S

    useful!like this site


  • 0
    H
    print("Hello World")

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.