• [PHP data structure] Application of stack and queue


    Through the study of stack and queue, we seem to feel that the data structure is still very simple. Of course, this is just the beginning. We start from the sequence list and linked list to the current stack and queue, which are actually to pave the way for the future. Stack and queue can […]

  • I use js to brush leetcode | day 6 | palindrome number


    I use js to brush leetcode | day 6 | palindrome number Number of palindromes: Note: the complexity problem is not considered at this stage Starting address: http://www.brandhuang.com/article/1583842055249 Question: Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Coud you solve it without converting […]

  • Netease 2020 / 9 / 12 written examination


    Question 1 gender characteristics BFS:`var line; var j = 0; var arr = []; while(line=readline()){ var a = [];// Two dimensional array for(var k = 0; k<line; k++){ a.push(readline()); } } function init(j) { //Depth first search if(j===line){ console.log(arr.join(“-“)); return; } for(var i = 0;i<a[j].length;i++){ //Principle of reactor arr.push(aj); init(j+1); arr.pop(); } } init(j);` Question […]

  • Algorithm learning


    Sorting algorithm Bubble sorting public class Main { public static void bubbleSort(int[] arr) { if (arr == null || arr.length < 2) { return; } for (int e = arr.length – 1; e > 0; e–) { for (int i = 0; i < e; i++) { if (arr[i] > arr[i + 1]) { swap(arr, […]

  • Guide to incomplete palindrome / String [using C + +]


    Let’s look at the title: leetcode-9Palindrome, that is to say, forward reading and reverse reading are the same. For example, 12321 is a palindrome number and daaad is a palindrome string.If a string type is given, we can use [0] and. Size () – 1 to traverse the strings on both sides at the same […]

  • C / C + + Programming Notes: palindrome examples


          Palindrome number is the same number in reverse (read from the left and read from the right are the same number). For example: 121345431314894 these are palindromic numbers. Palindrome number algorithm Get numbers from user input Save the number in a temporary variable Reverse number Compare temporary numbers with inverted numbers If […]

  • Long palindromic substring


    Title: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: “babad” Output: “bab” Note: “aba” is also a valid answer. Example 2: Input: “cbbd” Output: “bb” Title Translation: Very classic topic, for the longest palindrome string How to solve […]

  • Leetcode 680. Verify palindrome string II | Python


    680. Verify palindrome string II Title Source: https://leetcode-cn.com/problems/valid-palindrome-ii subject Given a non empty string s, at most one character is deleted. Determine whether it can be a palindrome string. Example 1: Input: “ABA” Output: true Example 2: Input: “ABCA” Output: true Explanation: you can delete the C character. be careful: The string contains only lowercase […]

  • Python brush topic: Longest palindrome substring (string)


    Title Description Given a string containing only lowercase letters, find the length of its longest palindrome substring. Palindrome string refers to the character string with left and right symmetry. Thinking of solving problems When the string is not empty, the palindrome substring is at least one character, that is, the initial length is 1. When […]

  • The journey of leetcode


    subject Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1:Input: 121Output: true Example 2:Input: -121Output: falseExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3:Input: 10Output: falseExplanation: Reads 01 from right to left. […]

  • The beauty of discovery algorithm: collision pointer of two pointers


    What is a collision pointer? First knowledge Algorithm diagram Collision process diagram Array and collision pointer in JavaScript How to define collision pointer in JS? Implementation of a simplest collision pointer Leetcode collision pointer solution problem 7. Integer inversion (easy) 9. Palindrome number (easy) 27. Remove element (easy) 125. Verify palindrome string (easy) 167. II […]

  • Leetcode 9. Palindrome number in Python


    Title Requirements: Idea 1 (converting STR to list) First judge whether the number is less than 0, and return false if it is less than 0 Judge whether the number is less than 10. If it is less than 10, return true, because the single digit is palindrome If the above two items do not […]