Java Features Released in the last decade

Java has undergone several upgrades and improvements since version 6. Here are some of the major new features that were introduced in later versions of Java: Java 7 (released in 2011): Diamond Operator for Type Inference in Generics This operator simplifies the creation of generic objects by automatically inferring the type of arguments passed to ...

How To Live Stress-Free Life

How To Live Stress-Free Life

Solved! Leetcode 573. Squirrel Simulation

source: https://leetcode.com/problems/squirrel-simulation/ Table of ContentsSquirrel SimulationDescriptionExample 1Example 2ConstraintsSolution Squirrel Simulation Description You are given two integers height and width representing a garden of size height x width. You are also given: an array tree where tree = [treer, treec] is the position of the tree in the garden, an array squirrel where squirrel = [squirrelr, ...

Solved! Leetcode 63. Unique Paths II

source: https://leetcode.com/problems/unique-paths-ii/ Unique Paths II Table of ContentsUnique Paths IIDescriptionExample 1:Example 2:Constraints:Solution Description You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m – 1][n – 1]). The robot can only move ...

Solved! Leetcode 1557. Minimum Number of Vertices to Reach All Nodes

source: https://leetcode.com/problems/minimum-number-of-vertices-to-reach-all-nodes/description/ Minimum Number of Vertices to Reach All Nodes Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed edge from node fromi to node toi. Find the smallest set of vertices from which all nodes in the graph ...

Solved! Leetcode 101. Symmetric Tree

source: https://leetcode.com/problems/symmetric-tree/description/ Symmetric Tree Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3] Output: true Example 2: Input: root = [1,2,2,null,3,null,3] Output: false Constraints: The number of nodes in the tree is in the range [1, 1000]. -100 ...

Solved! Leetcode 72. Edit Distance

source: https://leetcode.com/problems/edit-distance/ Edit Distance Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations permitted on a word: Insert a character Delete a character Replace a character Example 1: Input: word1 = “horse”, word2 = “ros” Output: 3 Explanation: horse -> ...