Leetcode #947: Most Stones Removed with Same Row or Column
func removeStones(_ stones: [[Int]]) -> Int { var xDict = [Int: [Int]]() var yDict = [Int: [In...
322 search resultsShowing 1~20 results
You need to log-in
func removeStones(_ stones: [[Int]]) -> Int { var xDict = [Int: [Int]]() var yDict = [Int: [In...
import Foundation class Solution { func crackSafe(_ n: Int, _ k: Int) -> String { var totalSiz...
func calculateTime(_ keyboard: String, _ word: String) -> Int { var ar = Array(repeating: 0, c...
func numSmallerByFrequency(_ queries: [String], _ words: [String]) -> [Int] { var ar = Array(r...
Solution 1: Recursion func PredictTheWinner(_ nums: [Int]) -> Bool { return winner(nums, 0, nu...
func findReplaceString(_ S: String, _ indexes: [Int], _ sources: [String], _ targets: [String]) -...
class BSTIterator { private var ar = [Int]() private var index = 0 init(_ root: TreeNode?) { ar =...
class RLEIterator { private var ar = [Int]() private var num = [Int]() private var current = 0 pr...
func countUnivalSubtrees(_ root: TreeNode?) -> Int { if root == nil { return 0 } if root?.left...
func exclusiveTime(_ n: Int, _ logs: [String]) -> [Int] { var answer = Array(repeating: 0, cou...
func isNStraightHand(_ hand: [Int], _ W: Int) -> Bool { if hand.count % W != 0 { return false ...
func oddEvenList(_ head: ListNode?) -> ListNode? { let dummyNode = ListNode(0) dummyNode.next ...
Solution 1: Sorting func findDuplicate(_ nums: [Int]) -> Int { var nums = nums.sorted() for i ...
Solution 1: Recursively func upsideDownBinaryTree(_ root: TreeNode?) -> TreeNode? { if root ==...
class TimeMap { /** Initialize your data structure here. */ private var timestamps = [String: [In...
func maxProfit(_ prices: [Int], _ fee: Int) -> Int { var cash = 0 var hold = -prices[0] for i ...
func longestStrChain(_ words: [String]) -> Int { let words = words.sorted { $0.count < $1.c...
func findDuplicate(_ paths: [String]) -> [[String]] { var dict = [String: [String]]() for path...
func updateBoard(_ board: [[Character]], _ click: [Int]) -> [[Character]] { var board = board ...
func shipWithinDays(_ weights: [Int], _ D: Int) -> Int { var start = weights.max()! var end = ...
322 search resultsShowing 1~20 results
Qiita is a knowledge sharing service for engineers.