首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏SnailTyan

    Push Dominoes

    Version 1 class Solution: def pushDominoes(self, dominoes: str) -> str: n = len(dominoes) = n: if dominoes[left] == 'R' and dominoes[right] == 'L': elif dominoes[left] == 'L' and dominoes[right] == 'L': state[i] = 'L' 2 class Solution: def pushDominoes(self, dominoes: str) -> str: n = len(dominoes) state = list(dominoes) i = 0 while i < n: if dominoes[i] == 'L':

    30020发布于 2021-07-14
  • 来自专栏全栈程序员必看

    ZOJ Problem Set – 2563 Long Dominoes 【如压力dp】

    大家好,又见面了,我是全栈君 称号:ZOJ Problem Set – 2563 Long Dominoes 题意:给出1*3的小矩形。求覆盖m*n的矩阵的最多的不同的方法数?

    29130编辑于 2022-07-06
  • 来自专栏Michael阿明学习之路

    LeetCode 838. 推多米诺(模拟)

    ) { int n = dominoes.size(), L = 0, R = n-1, l=-1, r=-1, i; while(L < n && dominoes[L L++; } while(R >= 0 && dominoes[R] ! = -1)//右侧存在向右倒的 for(i = r+1; i < dominoes.size(); i++) dominoes[i] = 'R'; ,可以简化代码量 class Solution { public: string pushDominoes(string dominoes) { dominoes = 'L'+dominoes return dominoes.substr(1,n-2); } }; 36 ms 12.6 MB

    61010发布于 2021-02-19
  • 来自专栏从零开始的Code生活

    LeetCode 1128. 等价多米诺骨牌对的数量(哈希)

    形式上,dominoes[i] = [a, b] 和 dominoes[j] = [c, d] 等价的前提是 a==c 且 b==d,或是 a==d 且 b==c。 在 0 <= i < j < dominoes.length 的前提下,找出满足 dominoes[i] 和 dominoes[j] 等价的骨牌对 (i, j) 的数量。 = i + 1; j < dominoes.size(); j++) { if (dominoes[i][0] == dominoes[j][0] && dominoes } if (dominoes[i][1] == dominoes[j][0] && dominoes[i][0] == dominoes[j][1]) { { if (dominoes[i][0] > dominoes[i][1]) { mp[dominoes[i][1] * 10 + dominoes

    31410编辑于 2022-01-13
  • 来自专栏宫水三叶的刷题日记

    【刷穿 LeetCode】1128. 等价多米诺骨牌对的数量(简单)

    题目描述 给你一个由一些多米诺骨牌组成的列表 dominoes。 如果其中某一张多米诺骨牌可以通过旋转 0 度或 180 度得到另一张多米诺骨牌,我们就认为这两张牌是等价的。 形式上,dominoes[i] = [a, b] 和 dominoes[j] = [c, d] 等价的前提是 a==c 且 b==d,或是 a==d 且 b==c。 在 0 <= i < j < dominoes.length 的前提下,找出满足 dominoes[i] 和 dominoes[j] 等价的骨牌对 (i, j) 的数量。 示例: 输入:dominoes = [[1,2],[2,1],[3,4],[5,6]] 输出:1 提示: 1 <= dominoes.length <= 40000 1 <= dominoes[i][ j] <= 9 ---- 哈希表解法 dominoes 中的值的范围是 [1,9],因此可以使用单个骨牌里的两个数来构建成一个范围在 [11,99] 的数。

    52920发布于 2021-02-20
  • 来自专栏Michael阿明学习之路

    LeetCode 1128. 等价多米诺骨牌对的数量(哈希)

    题目 给你一个由一些多米诺骨牌组成的列表 dominoes。 如果其中某一张多米诺骨牌可以通过旋转 0 度或 180 度得到另一张多米诺骨牌,我们就认为这两张牌是等价的。 形式上,dominoes[i] = [a, b] 和 dominoes[j] = [c, d] 等价的前提是 a=c 且 b=d,或是 a=d 且 b=c。 在 0 <= i < j < dominoes.length 的前提下,找出满足 dominoes[i] 和 dominoes[j] 等价的骨牌对 (i, j) 的数量。 示例: 输入:dominoes = [[1,2],[2,1],[3,4],[5,6]] 输出:1 提示: 1 <= dominoes.length <= 40000 1 <= dominoes[i] ) { unordered_map<int,int> m;//多米诺组成的最小两位数,-->计数 int num; for(auto& d : dominoes

    56320发布于 2020-07-13
  • 来自专栏Reck Zhang

    ACMSGURU 101 - Domino

    Domino Problem Description Dominoes – game played with small, rectangular blocks of wood or other material The blocks usually are called bones, dominoes, or pieces and sometimes men, stones, or even cards. two squares, each of which is marked as would be a pair of dice… The principle in nearly all modern dominoes

    63320发布于 2021-08-11
  • 【HDU】5777 - domino(贪心)

    Submission(s): 353 Problem Description Little White plays a game.There are n pieces of dominoes On the assumption that all of the tiles are fallen in the end, he can set the height of all dominoes, but he wants to minimize the sum of all dominoes height. adjacent domino d, Output For each testcase, output of a line, the smallest sum of all dominoes

    25010编辑于 2025-08-27
  • 来自专栏AIoT技术交流、分享

    力扣(LeetCode)刷题,简单+中等题(第31期)

    回答(C语言): int numEquivDominoPairs(int** dominoes, int dominoesSize, int* dominoesColSize) { int num num, 0, sizeof(num)); int ret = 0; for (int i = 0; i < dominoesSize; i++) { int val = dominoes [i][0] < dominoes[i][1] ? dominoes[i][0] * 10 + dominoes[i][1] : dominoes[i][1] * 10 + dominoes[i][0]; ret += num[val];

    40650发布于 2021-03-02
  • 来自专栏iOSDevLog

    iOS版 使用ARKit和Swift创建交互式Domino游戏

    dominoes.gif 先决条件 这是一个中级教程,要求您对Swift有一个很好的理解,以及ARKit和SceneKit的一些基本知识。 将以下变量添加到类的顶部: var dominoes: [SCNNode] = [] 最简单形式的命中测试是确定用户触摸的屏幕的2D位置是否与现实世界中的任何虚拟对象或在我们的情况下与平面相交。 7.png 在startButtonPressed方法中添加以下代码行: // 1 guard let firstDomino = dominoes.first else { return } 属性设置为nil,并将dominoes数组设置为空,以便我们可以重新开始。 dominoes.gif 这是iOS开发人员Koushan Korouei的客座文章,专注于ARKit。该文章首次发表于Medium。

    3.1K30发布于 2019-03-06
  • 来自专栏算法修养

    HOJ 2124 &POJ 2663Tri Tiling(动态规划)

    Submissions: 9016 Accepted: 4684 Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes

    655100发布于 2018-04-26
  • 来自专栏饶文津的专栏

    「POJ 1135」Domino Effect(dfs)

    \n", last); else{ if(last>second)swap(last,second); printf("between key dominoes %d and %d.

    45710发布于 2020-06-02
  • 来自专栏冰霜之地

    LeetCode 分类刷题—— Two Pointers

    Push Dominoes Go Medium O(n) O(n) 844. Backspace String Compare Go Easy O(n) O(n) 845.

    25310编辑于 2024-02-12
  • 来自专栏DeepHub IMBA

    利用关联规则实现推荐算法

    T-LIGHT HOLDER 12.0 # PACK 3 FIRE ENGINE/CAR PATCHES 12.0 # PICTURE DOMINOES

    1K30编辑于 2021-12-28
  • 让 AI 自己进化自己:深入 HyperAgents

    Javasgf-parsing✅JavaScriptbottle-song,robot-name✅✅Rustbowling,variable-length-quantity✅✅Pythonbeer-song,dominoes Python的两道题(beer-song、dominoes)在两代里始终未解。

    26800编辑于 2026-04-08
领券