热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

LeetCode1540.K次操作转变字符串哈希

地址 https:leetcode-cn.comproblemscan-convert-string-in-k-moves给你两个字符串 s 和 t ,你的目标是在k 次操作以内把

.---------------------------------------------------------------------------.
| |
| Bash History Cheat Sheet |
| |
---------------------------------------------------------------------v1.12-
| Created by Peter Krumins (peter@catonmat.net, @pkrumins on twitter) |
| www.catonmat.net -- good coders code, great coders reuse |
| |
| Released under the GNU Free Document License |
---------------------------------------------------------------------------
===================== Emacs Keyboard Shortcut Summary =====================
.
--------------.------------------------------------------------------------.
| | |
| Shortcut | Description |
| | |
--------------+------------------------------------------------------------
| C-p | Fetch the previous command from the history list. |
--------------+------------------------------------------------------------
| C-n | Fetch the next command from the history list. |
--------------+------------------------------------------------------------
| M-<| Move to the first line in the history. |
--------------+------------------------------------------------------------
| M-> | Move to the end of the input history. |
--------------+------------------------------------------------------------
| C-r | Search backward starting at the current line (incremental) |
--------------+------------------------------------------------------------
| C-s | Search forward starting at the current line (incremental). |
--------------+------------------------------------------------------------
| M-p | Search backward using non-incremental search. |
--------------+------------------------------------------------------------
| M-n | Search forward using non-incremental search |
--------------------------------------------------------------------------

======================= Vi Keyboard Shortcut Summary ======================
.
--------------.------------------------------------------------------------.
| | |
| Shortcut | Description |
| | |
--------------+------------------------------------------------------------
| k | Fetch the previous command from the history list. |
--------------+------------------------------------------------------------
| j | Fetch the next command from the history list. |
--------------+------------------------------------------------------------
| /string or | Search history backward for a command matching string. |
| CTRL-r | |
--------------+------------------------------------------------------------
| ?string or | Search history forward for a command matching string. |
| CTRL-s | (Note that on most machines Ctrl-s STOPS the terminal |
| | output, change it with `stty (Ctrl-q to resume)). |
--------------+------------------------------------------------------------
| n | Repeat search in the same direction as previous. |
--------------+------------------------------------------------------------
| N | Repeat search in the opposite direction as previous. |
--------------+------------------------------------------------------------
| G | Move to history line N (for example, 15G). |
--------------------------------------------------------------------------

======================== History Expansion Summary ========================

Event Designators:
.
--------------.------------------------------------------------------------.
| | |
| Designator | Description |
| | |
--------------+------------------------------------------------------------
| ! | Start a history substitution. |
--------------+------------------------------------------------------------
| !! | Refer to the last command. |
--------------+------------------------------------------------------------
| !n | Refer to the n-th command line (try `history command). |
--------------+------------------------------------------------------------
| !-n | Refer to the current command line minus n. |
--------------+------------------------------------------------------------
| !string | Refer to the most recent command starting with string. |
--------------+------------------------------------------------------------
| !?string? | Refer to the most recent command containing string. |
--------------+------------------------------------------------------------
| ^str1^str2^ | Quick substitution. Repeat the last command, replacing |
| | str1 with str2. |
--------------+------------------------------------------------------------
| !# | Refer to the entire command line typed so far. |
--------------------------------------------------------------------------

Word Designators:
(Word designators follow the event designators, separated by a collon
:)
.
--------------.------------------------------------------------------------.
| | |
| Designator | Description |
| | |
--------------+------------------------------------------------------------
| 0 | The zeroth (first) word in a line (usually command name). |
--------------+------------------------------------------------------------
| n | The n-th word in a line. |
--------------+------------------------------------------------------------
| ^ | The first argument (the second word) in a line. |
--------------+------------------------------------------------------------
| $ | The last argument in a line. |
--------------+------------------------------------------------------------
| % | The word matched by the most recent string search. |
--------------+------------------------------------------------------------
| x-y | A range of words from x to y (-y is synonymous with 0-y). |
--------------+------------------------------------------------------------
| * | All words but the zeroth (synonymous with 1-$). |
--------------+------------------------------------------------------------
| x* | Synonymous with x-$ |
--------------+------------------------------------------------------------
| x- | The words from x to the second to last word. |
--------------------------------------------------------------------------

Modifiers (modifiers follow word designators, separated by a colon):
.
--------------.------------------------------------------------------------.
| | |
| Modifier | Description |
| | |
--------------+------------------------------------------------------------
| h | Remove a trailing pathname component, leaving the head. |
--------------+------------------------------------------------------------
| t | Remove all leading pathname component, leaving the tail. |
--------------+------------------------------------------------------------
| r | Remove a trailing suffix of the form .xxx, leaving the |
| | basename. |
--------------+------------------------------------------------------------
| e | Remove all but the trailing suffix. |
--------------+------------------------------------------------------------
| p | Print the resulting command but do not execute it. |
--------------+------------------------------------------------------------
| q | Quotes the substituted words, escaping further |
| | substitutions. |
--------------+------------------------------------------------------------
| x | Quotes the substituted words, breaking them into words at |
| | blanks and newlines. |
--------------+------------------------------------------------------------
| s/old/new/ | Substitutes new for old. |
--------------+------------------------------------------------------------
| & | Repeats the previous substitution. |
--------------+------------------------------------------------------------
| g | Causes s/old/new/ or & to be applied over the entire |
| | event line. |
--------------------------------------------------------------------------

============ History Behavior Modification via Shell Variables ============
.
----------------.----------------------------------------------------------.
| | |
| Shell Variable | Description |
| | |
----------------+----------------------------------------------------------
| HISTFILE | Controls where the history file gets saved. |
| | Set to /dev/null not to save the history. |
| | Default: ~/.bash_history |
----------------+----------------------------------------------------------
| HISTFILESIZE | Controls how many history commands to keep in HISTFILE |
| | Default: 500 |
----------------+----------------------------------------------------------
| HISTSIZE | Controls how many history commands to keep in the |
| | history list of current session. |
| | Default: 500 |
----------------+----------------------------------------------------------
| HISTIGNORE | Controls which commands to ignore and not save to the |
| | history list. The variable takes a list of |
| | colon separated values. Pattern & matches the previous |
| | history command. |
--------------------------------------------------------------------------

============ History Behavior Modification via `shopt Command ============

.
----------------.----------------------------------------------------------.
| | |
| shopt Option | Description |
| | |
----------------+----------------------------------------------------------
| histappend | Setting the variable appends current session history to |
| | HISTFILE. Unsetting overwrites the file each time. |
----------------+----------------------------------------------------------
| histreedit | If set, puts a failed history substitution back on the |
| | command line for re-editing. |
----------------+----------------------------------------------------------
| histverify | If set, puts the command to be executed after a |
| | substitution on command line as if you had typed it. |
--------------------------------------------------------------------------

shopt options can be set by a `shopt
-s option and
can be unset by a `shopt -u option.
=============================== Examples ==================================
$
echo a b c d e (executes `echo ab c d e`)
a b c d e
$
echo !!:3-$ (executes `echo c d e`)
c d e
$
echo !-2:*:q (executes `echo a b c d e`)
a b c d e
$
echo !-3:1:2:4:x (executes `echo a b d`)
a b d
$
echo !-4:1-3:s/a/foo/:s/b/bar/:s/c/baz/ (executes `echo foo bar baz`)
foo bar baz
$
tar -xzf package-x.y.z.tgz
...
$ cd
!-1:$:r (executes `cd package-x.y.z`)
package
-x.y.z $

$
ls -a /tmp
file1 file2 file3 ...
$
^-a^-l^ (executes `ls -l /tmp`)
-rw------- 1 user user file1
...
===========================================================================
.
---------------------------------------------------------------------------.
| Created by Peter Krumins (peter@catonmat.net, @pkrumins on twitter) |
| www.catonmat.net -- good coders code, great coders reuse |
---------------------------------------------------------------------------

 

LeetCode 1540. K 次操作转变字符串 哈希



推荐阅读
  • 题目描述:小K不幸被LL邪教洗脑,洗脑程度之深使他决定彻底脱离这个邪教。在最终离开前,他计划再进行一次亚瑟王游戏。作为最后一战,他希望这次游戏能够尽善尽美。众所周知,亚瑟王游戏的结果很大程度上取决于运气,但通过合理的策略和算法优化,可以提高获胜的概率。本文将详细解析洛谷P3239 [HNOI2015] 亚瑟王问题,并提供具体的算法实现方法,帮助读者更好地理解和应用相关技术。 ... [详细]
  • Django框架下的对象关系映射(ORM)详解
    在Django框架中,对象关系映射(ORM)技术是解决面向对象编程与关系型数据库之间不兼容问题的关键工具。通过将数据库表结构映射到Python类,ORM使得开发者能够以面向对象的方式操作数据库,从而简化了数据访问和管理的复杂性。这种技术不仅提高了代码的可读性和可维护性,还增强了应用程序的灵活性和扩展性。 ... [详细]
  • 在 Linux 系统中,`/proc` 目录实现了一种特殊的文件系统,称为 proc 文件系统。与传统的文件系统不同,proc 文件系统主要用于提供内核和进程信息的动态视图,通过文件和目录的形式呈现。这些信息包括系统状态、进程细节以及各种内核参数,为系统管理员和开发者提供了强大的诊断和调试工具。此外,proc 文件系统还支持实时读取和修改某些内核参数,增强了系统的灵活性和可配置性。 ... [详细]
  • 本文深入探讨了 iOS 开发中 `int`、`NSInteger`、`NSUInteger` 和 `NSNumber` 的应用与区别。首先,我们将详细介绍 `NSNumber` 类型,该类用于封装基本数据类型,如整数、浮点数等,使其能够在 Objective-C 的集合类中使用。通过分析这些类型的特性和应用场景,帮助开发者更好地理解和选择合适的数据类型,提高代码的健壮性和可维护性。苹果官方文档提供了更多详细信息,可供进一步参考。 ... [详细]
  • 解决基于XML配置的MyBatis在Spring整合中出现“无效绑定语句(未找到):com.music.dao.MusicDao.findAll”问题的方法
    在将Spring与MyBatis进行整合时,作者遇到了“无效绑定语句(未找到):com.music.dao.MusicDao.findAll”的问题。该问题主要出现在使用XML文件配置DAO层的情况下,而注解方式配置则未出现类似问题。作者详细分析了两个配置文件之间的差异,并最终找到了解决方案。本文将详细介绍问题的原因及解决方法,帮助读者避免类似问题的发生。 ... [详细]
  • 在 HihoCoder 1505 中,题目要求从给定的 n 个数中选取两对数,使这两对数的和相等。如果直接对所有可能的组合进行遍历,时间复杂度将达到 O(n^4),因此需要考虑优化选择过程。通过使用哈希表或其他高效的数据结构,可以显著降低时间复杂度,从而提高算法的效率。具体实现中,可以通过预处理和存储中间结果来减少重复计算,进一步提升性能。 ... [详细]
  • 在 Android 开发中,通过合理利用系统通知服务,可以显著提升应用的用户交互体验。针对 Android 8.0 及以上版本,开发者需首先创建并注册通知渠道。本文将详细介绍如何在应用中实现这一功能,包括初始化通知管理器、创建通知渠道以及发送通知的具体步骤,帮助开发者更好地理解和应用这些技术细节。 ... [详细]
  • 当前,众多初创企业对全栈工程师的需求日益增长,但市场中却存在大量所谓的“伪全栈工程师”,尤其是那些仅掌握了Node.js技能的前端开发人员。本文旨在深入探讨全栈工程师在现代技术生态中的真实角色与价值,澄清对这一角色的误解,并强调真正的全栈工程师应具备全面的技术栈和综合解决问题的能力。 ... [详细]
  • 深入解析Gradle中的Project核心组件
    在Gradle构建系统中,`Project` 是一个核心组件,扮演着至关重要的角色。通过使用 `./gradlew projects` 命令,可以清晰地列出当前项目结构中包含的所有子项目,这有助于开发者更好地理解和管理复杂的多模块项目。此外,`Project` 对象还提供了丰富的配置选项和生命周期管理功能,使得构建过程更加灵活高效。 ... [详细]
  • 本文介绍了一种简化版的在线购物车系统,重点探讨了用户登录和购物流程的设计与实现。该系统通过优化界面交互和后端逻辑,提升了用户体验和操作便捷性。具体实现了用户注册、登录验证、商品浏览、加入购物车以及订单提交等功能,旨在为用户提供高效、流畅的购物体验。 ... [详细]
  • JVM参数设置与命令行工具详解
    JVM参数配置与命令行工具的深入解析旨在优化系统性能,通过合理设置JVM参数,确保在高吞吐量的前提下,有效减少垃圾回收(GC)的频率,进而降低系统停顿时间,提升服务的稳定性和响应速度。此外,本文还将详细介绍常用的JVM命令行工具,帮助开发者更好地监控和调优JVM运行状态。 ... [详细]
  • 在Spring框架中,基于Schema的异常通知与环绕通知的实现方法具有重要的实践价值。首先,对于异常通知,需要创建一个实现ThrowsAdvice接口的通知类。尽管ThrowsAdvice接口本身不包含任何方法,但开发者需自定义方法来处理异常情况。此外,环绕通知则通过实现MethodInterceptor接口来实现,允许在方法调用前后执行特定逻辑,从而增强功能或进行必要的控制。这两种通知机制的结合使用,能够有效提升应用程序的健壮性和灵活性。 ... [详细]
  • 在使用关系型数据库时,通常需要通过用户名和密码进行身份验证才能访问数据。然而,MongoDB默认情况下并不强制要求这种身份验证机制,使得用户无需凭据即可访问并执行各种操作。虽然这一设计简化了初学者的上手过程,但也带来了显著的安全风险。为了提升MongoDB的连接安全性,本文将探讨多种策略与实践,包括启用身份验证、配置网络访问控制、加密通信以及定期审计安全设置,以确保数据库的安全性和数据的完整性。 ... [详细]
  • SQLmap自动化注入工具命令详解(第28-29天 实战演练)
    SQL注入工具如SQLMap等在网络安全测试中广泛应用。SQLMap是一款开源的自动化SQL注入工具,支持12种不同的数据库,具体支持的数据库类型可在其插件目录中查看。作为当前最强大的注入工具之一,SQLMap在实际应用中具有极高的效率和准确性。 ... [详细]
  • MVVM架构~mvc,mvp,mvvm大话开篇
    返回目录百度百科的定义:MVP是从经典的模式MVC演变而来,它们的基本思想有相通的地方:ControllerPresenter负责逻辑的处理,Model提供数据,View负责显示。作为一种新的模 ... [详细]
author-avatar
mobiledu2502887107
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有