컴퓨터공학/LeetCode 1000
[LeetCode] 1971. Find if Path Exists in Graph
1971. Find if Path Exists in Graph Easy There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge between vertex ui and vertex vi. Every vertex pair is connected by at most one edge, and no vertex has an edge to itself. ..
[LeetCode] 1066. Campus Bikes II
1066. Campus Bikes II Medium On a campus represented as a 2D grid, there are n workers and m bikes, with n
[LeetCode] 841. Keys and Rooms
841. Keys and Rooms Medium There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key. When you visit a room, you may find a set of distinct keys in it. Each key has a number on it, denoting which room it unlocks, and you can take all of them with you to unlock the o..
[LeetCode] 739. Daily Temperatures
739. Daily Temperatures Medium Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead. Example 1: Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,..
[LeetCode] 2272. Substring With Largest Variance
2272. Substring With Largest Variance Hard The variance of a string is defined as the largest difference between the number of occurrences of any 2 characters present in the string. Note the two characters may or may not be the same. Given a string s consisting of lowercase English letters only, return the largest variance possible among all substrings of s. A substring is a contiguous sequence ..
[LeetCode] 323. Number of Connected Components in an Undirected Graph
323. Number of Connected Components in an Undirected Graph Medium You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph. Return the number of connected components in the graph. Example 1: Input: n = 5, edges = [[0,1],[1,2],[3,4]] Output: 2 Example 2: Input: n = 5, edges = [[0,1],[1,2],[2..
[LeetCode] 2256. Minimum Average Difference
2256. Minimum Average Difference Medium You are given a 0-indexed integer array nums of length n. The average difference of the index i is the absolute difference between the average of the first i + 1 elements of nums and the average of the last n - i - 1 elements. Both averages should be rounded down to the nearest integer. Return the index with the minimum average difference. If there are mul..
[LeetCode] 328. Odd Even Linked List
328. Odd Even Linked List Medium Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the second node is even, and so on. Note that the relative order inside both the even and odd groups should remain as it was in the input. You must solve the problem in ..