| |

VerySource

 Forgot password?
 Register
Search
Author: 别叫我女生

Interview questions, not done

[Copy link]

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-14 21:30:01
| Show all posts
Learn
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-3-19 16:30:01
| Show all posts
kevinak123Thank you
But can you put
ret + = s [i];
getOne (ret, pos + 1);
ret = ret.substring (0, pos-1);
The control logic is here, if you want to do special processing for some bits, do it here
You can draw a trick for each function call, knowing its internal principles, you can modify it arbitrarily.

   Let me be clear, thank you;
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-3-20 18:30:02
| Show all posts
Landlord, describe the needs!

Also, the code for borrowing flowers upstairs was originally written by me, but I did not understand
if (prefix.length () == 3)
{
System.out.println (prefix);
}
The purpose of this code

The original of this program was answered by another post from lz:
http://community.csdn.net/Expert/TopicView.asp?id=5265197

That's a matter of alignment. What is lz here?
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-11 13:45:02
| Show all posts
Specify a fully arranged number of digits, and only list the digits. For example, 1 2 3 lists only 2 digits, so 11 12 13 21 22 23 31 32 33
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-12 14:30:01
| Show all posts
Not the one I wrote, the listAll method adds a parameter, when the prefix length passed in, it prints and ends the recursion

  public static void main (String [] args) throws Exception {
    String [] array = new String [] {
        "1", "2", "3", "4"
    };
    listAll (Arrays.asList (array), "", 3);
  }

  public static void listAll (List candidate, String prefix, int length) {
// if (candidate == null || candidate.isEmpty ()) {
    if (prefix.length () == length) {
      System.out.println (prefix);
    }

    for (int i = 0; i <candidate.size (); i ++) {
      List temp = new LinkedList (candidate);
      listAll (temp, prefix + temp.remove (i), length);
    }
  }
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list