LeetCode brush notes binary tree binary search tree properties

Introduction to binary search tree Binary search tree (BST) is a special binary tree: for each parent node, the value of its left child node is less than or equal to the value of the parent node, and the value of its right child node is greater than or equal to the value of the parent node. Therefore, for a binary lookup tree, we can find out ...

Posted by markthien on Thu, 18 Nov 2021 19:53:01 -0800

[introduction to Linux] basic IO

✔ Review the interface of C file When learning C language, we learned some interfaces of C language for file operation. There are fopen, fclose, fputc, fgetc, fputs, fgets, fprintf, fscanf, fread, fwrite, etc Briefly review with a piece of code: #include<stdio.h> #include<string.h> int main() { FILE* fp=fope ...

Posted by utdfederation on Tue, 16 Nov 2021 17:48:11 -0800

leetcode circular linked list I & II

1. Circular linked list I 1.1 Title Description The link to this question comes from leetcode Example Advanced and tips: 1.1.1 interface function /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ bool hasCycle(struct ListNode *head) { } 1.2 general fra ...

Posted by ccgorman on Thu, 11 Nov 2021 15:15:50 -0800

[algorithm thousand question case] daily LeetCode punch in - 75. String addition

📢 preface 🚀 Algorithm problem 🚀 🌲 Punching out an algorithm problem every day is not only a learning process, but also a sharing process 😜🌲 Tip: the problem-solving programming languages in this column are C# and Java🌲 To maintain a state of learning every day, let's work together to become the great God of algorithm ...

Posted by timmybuck on Thu, 11 Nov 2021 14:11:48 -0800

Python knowledge notes (+ 4): understand the concepts of list, tuple and string

Recently, I encountered some basic concepts that I didn't understand very well when I was brushing Leetcode questions, so I need to supplement the basic knowledge. Therefore, the following are some basic concepts about List, Tuple and String that I summarized after consulting the materials. Understanding sequences (lists, tuples, and strings) ...

Posted by dhydrated on Wed, 10 Nov 2021 21:36:05 -0800

LeetCode brush notes linked list traversal linked list

160 intersecting linked list Given two linked lists, judge whether they intersect at a point, and find the intersection node. The input is two linked lists and the output is one node. If there are no intersecting nodes, an empty node is returned. Input: intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3 Out ...

Posted by suvarthi on Wed, 10 Nov 2021 19:12:06 -0800

[LeetCode]13. Roman numeral to integer

Title Description   Roman numerals contain the following seven characters: I, V, X, L, C, D and M. Character           numerical value I             1 V             5 X             10 L             50 C             100 D             500 M             1000 For example, the Roman numeral 2 is written as II, which ...

Posted by Guernica on Wed, 10 Nov 2021 00:35:53 -0800

Leetcode 488 Zuma games

You are participating in a variant of Zuma game. In this Zuma game variant, there is a row of colored balls on the desktop. The color of each ball may be red 'R', yellow 'Y', blue 'B', green 'G' or white 'W'. You also have some colored balls in your hand. Your goal is to empty all the balls on the table. Each round: Choose any one of the col ...

Posted by wisewood on Tue, 09 Nov 2021 14:21:41 -0800

On the hierarchical traversal of binary tree and the extension of written test questions (data structure)

1, Hierarchical traversal of binary tree It is unrealistic to traverse directly, because there are more nodes in the future, and not all nodes in each layer are 2k-1. If you traverse a node, save the child of the node and get it from the structure next time. Here, the child is saved in a queue (the node first placed in the space is ...

Posted by jwcsk8r on Tue, 09 Nov 2021 11:38:05 -0800

Palindromes 2021-11-08

Determine whether an integer is palindrome Title Description: Source: LeetCode 09 palindromes Give you an integer x, if x is a palindrome integer, return true; Otherwise, return false. Palindrome numbers refer to integers whose positive order (left-to-right) and reverse order (right-to-left) are read the same. For example, 121 is palindrome a ...

Posted by Kol on Tue, 09 Nov 2021 09:09:23 -0800