Graph 🌺
Components of a Graph
Vertices*/ˈvɜːrtɪsiː/*: Vertices are the fundamental units of the graph. Sometimes, vertices are also known as vertex or nodes. Every node/vertex can be labeled or unlabelled.
Edges: Edges are drawn or used to connect two nodes of the graph. It can be ordered pair of nodes in a directed graph. Edges can connect any two nodes in any possible way. There are no rules. Sometimes, edges are also known as arcs. Every edge can be labeled/unlabelled.
The graph ...
Array & Hash
Array & Hash 🌼NoteInterfaceAn interface is a completely “abstract class“ that is used to group related methods with empty bodies
12345// interfaceinterface Animal { public void animalSound(); // interface method (does not have a body) public void run(); // interface method (does not have a body)}
To access the interface methods, the interface must be “implemented” (kinda like inherited) by another class with the implements keyword (instead of extends). The body of the interface ...
GreedyAlgorithm
Lamda expression
also in lambada.java
lambda:
simplify:
lambda make method into implementations into objects like any other than can be saved into variables and passed into methods as parameters.
Greedy Algorithm 🌼455. Assign CookiesAssume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie ...
TwoPointer
TwoPointer 🌼双指针法将时间复杂度:O(n^2)的解法优化为 O(n)的解法。也就是降一个数量级,题目如下:
27.移除元素(opens new window)
15.三数之和(opens new window)
18.四数之和(opens new window)
链表相关双指针题目:
206.反转链表(opens new window)
19.删除链表的倒数第N个节点(opens new window)
面试题 02.07. 链表相交(opens new window)
142题.环形链表II
27. Remove ElementEasy
Example :
12345Input: nums = [0,1,2,2,3,0,4,2], val = 2Output: 5, nums = [0,1,4,0,3,_,_,_]Explanation: Your function should return k = 5, with the first five elements of nums containing 0, 0, 1, 3, and 4.Note that th ...
💐Welcome💐
Welcome to my corner of the internet🎇! This is where I share my battles and victories against Leetcode and other coding challenges. Think of it as a training diary for a superhero, but instead of saving the world, I’m saving lines of code. So buckle up, it’s going to be a wild ride❤️🔥!
MobileApp
https://www.w3schools.com/html/html_responsive.asp