ICode9

精准搜索请尝试: 精确搜索
  • LeetCode每日一题(Split Two Strings to Make Palindrome)2021-07-29 15:29:35

    You are given two strings a and b of the same length. Choose an index and split both strings at the same index, splitting a into two strings: aprefix and asuffix where a = aprefix + asuffix, and splitting b into two strings: bprefix and bsuffix where b =

  • 字符流2021-07-23 21:03:07

    字符输入流 /* * FileInputStream和FileOutputStream是字节流 * 字节流的祖宗类(基类)InputStream和OutputStream * * 字符流:相对于字节流每次需要操作字节数组而言,字符流就直接操作字符 * 字符流的祖宗类:Reader和Writer * 计算机底层只有字节流 * Reader: * 常用的子类:Fil

  • 每日一题:面试题 10.02. 变位词组2021-07-19 10:03:35

    解题思路 将每个字符串单独排序,如果构成的字符是相同的,那么排序结果也一定是相同的 利用Hash表判断这个字符串有没有出现过,如果没有出现就put排序后的字符串和对应ans中的index 利用一个index记录其在ans中的下标,利用此下标更新 代码 class Solution { public List<List<

  • [LeetCode] 1160. Find Words That Can Be Formed by Characters 拼写单词2021-07-15 09:34:44

    You are given an array of strings words and a string chars. A string is good if it can be formed by characters from chars (each character can only be used once). Return the sum of lengths of all good strings in words. Example 1: Input: words = ["c

  • 将文字转为汉语拼音2021-07-14 15:33:31

    <!--汉语拼音--><dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version></dependency> /** * @Description: * @Auther: CW * @Date: 2021/7/14 14:02 */@Sl

  • 回文串实现--轻松理解Manacher算法2021-07-10 19:29:47

    首先说一下什么是回文串? 回文串就是一个字符串的逆序和正序相同,此字符串就是回文串。比如:abcdedc中的 cdedc就是会问串。那么回文串问题怎么解决呢? 前置操作: 因为回文串分为奇数串和偶数串,比如奇数串为:abcba这样是以c为中心向两边扩,直接遍历字符串就行了,但是如果遇到偶数串的时

  • 【LeetCode每日一题】1160. 拼写单词2021-07-08 17:52:06

    给你一份『词汇表』(字符串数组) words 和一张『字母表』(字符串) chars。 假如你可以用 chars 中的『字母』(字符)拼写出 words 中的某个『单词』(字符串),那么我们就认为你掌握了这个单词。 注意:每次拼写时,chars 中的每个字母都只能用一次。 返回词汇表 words 中你掌握的所有单词

  • 电话号码字母组合-DFS2021-07-06 10:04:37

    /** * https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/ */ 解法二: public class _17_电话号码的字母组合2 { private char[][] lettersArray = { {'a', 'b', 'c'}, {'d', 'e', 'f'

  • 经常使用的一些公共方法2021-07-05 16:03:36

        #随机生成字符串 def random_str(self, num): str = '' chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-_' length = len(chars) - 1 for i in range(num): str +=chars[ra

  • kmp算法完成DNA的病毒感染检测2021-07-04 17:02:42

    运行结果: 代码: #include<cstring> #include<iostream> using namespace std; #define OK 1#define ERROR 0;#define OVERFLOW -2typedef int Status;#define MAXSTRLEN 255typedef char SString[MAXSTRLEN + 1];const int maxn = 100; Status StrAssign(SString T,

  • 用c++实现bf算法2021-07-04 17:01:40

    运行结果: 代码: #include<cstring> #include<iostream>using namespace std; #define OK 1#define ERROR 0#define OVERFLOW -2typedef int Status;#define MAXSTRLEN 255//用户可在255以内定义最长字符串typedef char SString[MAXSTRLEN + 1];//0号单元存放串的长度 SString S; St

  • leetcode 451 根据字符出现频率排序2021-07-03 15:34:18

    给定一个字符串,请将字符串里的字符按照出现的频率降序排列。 示例 1: 输入: "tree" 输出: "eert" 解释: 'e'出现两次,'r'和't'都只出现一次。 因此'e'必须出现在'r'和't'之前。此外,"eetr"也是一个有效的答案。 示例 2: 输入: "cccaaa" 输出: "

  • 443. String Compression2021-07-02 05:00:39

    Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group's length is 1, append the character to s. Otherwise, append the ch

  • 电话号码的字母组合2021-07-01 10:04:10

    https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/   public class _17_电话号码的字母组合 { private char[][] lettersArray = { {'a', 'b', 'c'}, {'d', 'e', 'f'}, {'g&#

  • JAVA字符串倒序输出2021-06-30 20:31:06

    代码如下: package com.java.day09; // 字符串倒序输出 public class StringReversed { public static void main(String[] args) { String str1 = "helloworld"; char[] chars = str1.toCharArray(); for (int i = chars.length - 1; i >= 0;

  • Spring Cloud Alibaba 大型互联网领域多场景最佳实践网盘下载2021-06-29 12:06:31

    download:Spring Cloud Alibaba 大型互联网领域多场景最佳实践   private static final char[] HEX_CHAR = {       '0', '1', '2', '3', '4', '5', '6', '7',       '8', '9', '

  • 人人都要学的项目管理课网盘下载2021-06-29 12:04:18

    download:人人都要学的项目管理课   private static final char[] HEX_CHAR = {       '0', '1', '2', '3', '4', '5', '6', '7',       '8', '9', 'A', 'B',

  • 中缀表达式转为后缀表达式2021-06-20 15:33:13

         /** * Created With IntelliJ IDEA. * Descriptions: * 1、定义一个栈stack,用来接收运算符;定义一个char类型数组chars,用于接收输出结果 * 2、从左到右遍历字符串,遇到字符添加到输chars,遇到运算符栈为空入栈,不为空, * 当前运算符A和栈顶运算符B比较,如果A的优先级大于B

  • 526,删除字符串中的所有相邻重复项2021-06-12 07:07:15

    It may not be pretty, but we headed to the city.  其貌虽不扬,扬帆亦远航。 问题描述 给出由小写字母组成的字符串S,重复项删除操作会选择两个相邻且相同的字母,并删除它们。   在S上反复执行重复项删除操作,直到无法继续删除。   在完成所有重复项删除操作后返回最终的字符串。

  • 496,字符串中的第一个唯一字符2021-06-12 07:06:50

      The only real failure is the failure to try. 真正的失败是未曾尝试。 问题描述 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 示例: s = "leetcode" 返回 0   s = "loveleetcode" 返回 2 提示:你可以假定该字符串只包含小写字母。    

  • [Java] 58.2 左旋转字符串2021-06-11 14:02:08

    描述 汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果。对于一个给定的字符序列S,请你把其循环左移K位后的序列输出。例如,字符序列S=”abcXYZdef”,要求输出循环左移3位后的结果,即“XYZdefabc”。是不是很简单?OK,搞定它! 示例 输

  • 1282. 翻转字符串中的元音字母2021-06-10 10:00:10

    1282. 翻转字符串中的元音字母   写一个方法,接受给定字符串作为输入,并且只翻转字符串中的元音字母。 样例 样例 1: 输入 : s = "hello" 输出 : "holle" 样例 2: 输入 : s = "lintcode" 输出 : "lentcodi". 注意事项 元音字母不包含字母 "y"

  • 矩阵中的路径2021-06-06 22:35:02

    题目描述 给定一个 m x n 二维字符网格 board 和一个字符串单词 word 。如果 word 存在于网格中,返回 true ;否则,返回 false 。 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。

  • 从零开始学keras之使用 LSTM 生成文本2021-06-05 16:53:03

    下面用 Keras 来实现这些想法。首先需要可用于学习语言模型的大量文本数据。我们可以使用任意足够大的一个或多个文本文件——维基百科、《指环王》等。本例将使用尼采的一些作品,他是 19 世纪末期的德国哲学家,这些作品已经被翻译成英文。因此,我们要学习的语言模型将是针对于尼采的

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有