This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package test; | |
| // The key observation is that in order to win Tic-Tac-Toe you must have the entire row or column. | |
| public class DesignTicTacToe { | |
| class TicTacToe { | |
| int[] rows; | |
| int[] cols; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private List<String> bfs(Map<String, Set<String>> graph, Set<String> visited, String start) { | |
| if (visited.contains(start)) return Collections.emptyList(); | |
| List<String> emails = new ArrayList<>(); | |
| Queue<String> queue = new LinkedList<>(); | |
| queue.offer(start); | |
| visited.add(start); | |
| while (!queue.isEmpty()) { | |
| int size = queue.size(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BFS | |
| visited = {} | |
| // initialize | |
| queue = [a] | |
| current_size = 0 | |
| offsets = [[0,1],[0,-1],[1,0],[-1,0]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "type": "Resource", | |
| "resourceChange": { | |
| "policyAction": "ReplaceAndDelete", | |
| "action": "Modify", | |
| "logicalResourceId": "TestAppMonitor", | |
| "physicalResourceId": "TestAppMonitor", | |
| "resourceType": "AWS::RUM::AppMonitor", | |
| "replacement": "True", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "CWACloudWatchServerPermissions", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "cloudwatch:PutMetricData", | |
| "ec2:DescribeVolumes", | |
| "ec2:DescribeTags", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "CWACloudWatchPermissions", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "cloudwatch:PutMetricData", | |
| "ec2:DescribeTags", | |
| "logs:PutLogEvents", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/runtime-db3ced03541c6a1dba73.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/pages-074ae03aaa397e157edc.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/nodes-empty-states-image-chrome-f42fa5df0e74c8aaa91c.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/dialogs-678c6bdbd3b98c546e3a.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/jquery-lodash-3809ac86f28ed37b84b5.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/clouddrive-flux-adapters-1981fc80a7972ac1ec20.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/moment-92a69cf17837993ab7e3.js'></script> | |
| <script crossorigin='anonymous' src='https://dcupkcmoyuvm5.cloudfront.net/react-virtualized-f223c90cce2a7c654658.js'></script> | |
| <script crossorigin='anonymous' sr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 2. 給兩個相同長度的integer array, 分別表示從A城市到B城市每天去程和回程的票價. | |
| * 要找出來回票價加總最便宜是多少,規定不能同天來回, 回程要在去程之後. | |
| * 舉例: departure=[10, 8, 9, 11, 7], arrival=[8, 8, 10, 7, 9], | |
| * 那結果是15 (departure[1] + arrival[3] = 8 + 7 = 15) | |
| */ | |
| public class CheapestFlights { | |
| public int cheapeast(int[] from, int[] to) { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| public int longestOnes(int[] nums, int k) { | |
| int n = nums.length; | |
| int countOfZero = 0; | |
| int longest = 0; | |
| //. s | |
| // [0,1,1,0,0,0,1,1,1,1,0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Definition for a binary tree node. | |
| * public class TreeNode { | |
| * int val; | |
| * TreeNode left; | |
| * TreeNode right; | |
| * TreeNode() {} | |
| * TreeNode(int val) { this.val = val; } | |
| * TreeNode(int val, TreeNode left, TreeNode right) { | |
| * this.val = val; |
NewerOlder