Recursion

Straight to the point, what is recursion—— To put it simply, recursion is a function that calls itself internally. A few simple interview questions, you can try to do, and then look at the reference code I wrote 1. Find the sum of 1-n. (if the sum of 1 to 100 is required) 2. Factorial 3. Flatten, de duplicate and sort the array. (&n ...

Posted by tomkleijkers on Fri, 20 May 2022 08:31:10 +0300

String full permutation algorithm_ C # version_ Sword finger OFFER

String full permutation algorithm_ C # version_ Sword finger OFFER Title Description Title Description Enter a string of length n and print out all the permutations of characters in the string. You can return this string array in any order. For example, if you input string ABC, all strings ABC,ACB,BAC,BCA,CBA and CAB that can be arranged b ...

Posted by saronoff on Tue, 17 May 2022 22:43:15 +0300

Sword finger offer: 12 Path in matrix

12 - path in center Source: LeetCode Link: https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/ Given an m x n two-dimensional character grid board and a string word word. If word exists in the grid, return true; Otherwise, false is returned. Words must be formed alphabetically by letters in adjacent cells, where "adjacent&q ...

Posted by cr55dan on Sun, 10 Apr 2022 15:49:55 +0300

Java foundation 11 file class, recursion

1. File class 1.1 what is the File class java.io.File class is an abstract representation of file and directory pathnames. It is mainly used for the creation, search and deletion of files and directories. 1.2 construction method public File(String pathname): create a new File instance by converting the given pathname string to an abstract p ...

Posted by sunwukung on Mon, 04 Apr 2022 03:53:15 +0300

Dynamic programming (example: 01 knapsack problem)

Introduction to dynamic programming    dynamic programming is a branch of operations research. It is a mathematical method to solve the optimization of multi-stage decision-making process. It is mainly used for the optimization of dynamic process divided into stages in time or below. It is also widely used in the field of compute ...

Posted by Lustre on Sun, 03 Apr 2022 06:25:55 +0300