自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

sunbocong的博客

靡不有初,鲜克有终。

  • 博客(201)
  • 收藏
  • 关注

原创 语法练习:left2

Given a string, return a “rotated left 2” version where the first 2 chars are moved to the end. The string length will be at least 2.left2(‘Hello’) → ‘lloHe’left2(‘java’) → ‘vaja’left2(‘Hi’) → ‘Hi’Expected Run left2(‘Hello’) → ‘lloHe’ ‘lloHe’ OK left

2022-12-08 11:28:00 499 1

原创 语法练习:non_start

Given 2 strings, return their concatenation, except omit the first char of each. The strings will be at least length 1.non_start(‘Hello’, ‘There’) → ‘ellohere’non_start(‘java’, ‘code’) → ‘avaode’non_start(‘shotl’, ‘java’) → ‘hotlava’Expected Run non_s

2022-12-08 11:25:02 470

原创 语法练习:combo_string

Given 2 strings, a and b, return a string of the form short+long+short, with the shorter string on the outside and the longer string on the inside. The strings will not be the same length, but they may be empty (length 0).combo_string(‘Hello’, ‘hi’) → ‘hiH

2022-12-08 11:22:35 437

原创 语法练习:without_end

Given a string, return a version without the first and last char, so “Hello” yields “ell”. The string length will be at least 2.without_end(‘Hello’) → ‘ell’without_end(‘java’) → ‘av’without_end(‘coding’) → ‘odin’Expected Run without_end(‘Hello’) → ‘el

2022-12-08 11:18:13 322

原创 语法练习:first_half

Given a string of even length, return the first half. So the string “WooHoo” yields “Woo”.first_half(‘WooHoo’) → ‘Woo’first_half(‘HelloThere’) → ‘Hello’first_half(‘abcdef’) → ‘abc’Expected Run first_half(‘WooHoo’) → ‘Woo’ ‘Woo’ OK first_half(‘HelloTh

2022-12-08 11:14:15 171

原创 语法练习:first_two

Given a string, return the string made of its first two chars, so the String “Hello” yields “He”. If the string is shorter than length 2, return whatever there is, so “X” yields “X”, and the empty string “” yields the empty string “”.first_two(‘Hello’) → ‘

2022-12-08 11:08:27 262

原创 语法练习:extra_end

Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string length will be at least 2.extra_end(‘Hello’) → ‘lololo’extra_end(‘ab’) → ‘ababab’extra_end(‘Hi’) → ‘HiHiHi’Expected Run extra_end(‘Hello’) → ‘l

2022-12-08 11:02:58 194

原创 语法练习:make_out_word

Given an “out” string length 4, such as “”, and a word, return a new string where the word is in the middle of the out string, e.g. “”.make_out_word(‘’, ‘Yay’) → ‘’make_out_word(‘’, ‘WooHoo’) → ‘’make_out_word(‘[[]]’, ‘word’) → ‘[[word]

2022-12-08 10:56:14 123

原创 语法练习:make_tags

The web is built with HTML strings like “Yay” which draws Yay as italic text. In this example, the “i” tag makes and which surround the word “Yay”. Given tag and word strings, create the HTML string with tags around the word, e.g. “Yay”.make_tags(‘i’, ‘Y

2022-12-08 10:53:30 153

原创 语法练习:make_abba

Given two strings, a and b, return the result of putting them together in the order abba, e.g. “Hi” and “Bye” returns “HiByeByeHi”.make_abba(‘Hi’, ‘Bye’) → ‘HiByeByeHi’make_abba(‘Yo’, ‘Alice’) → ‘YoAliceAliceYo’make_abba(‘What’, ‘Up’) → ‘WhatUpUpWhat’Ex

2022-12-08 10:47:28 136

原创 语法练习:hello_name

Given a string name, e.g. “Bob”, return a greeting of the form “Hello Bob!”.hello_name(‘Bob’) → ‘Hello Bob!’hello_name(‘Alice’) → ‘Hello Alice!’hello_name(‘X’) → ‘Hello X!’Expected Run hello_name(‘Bob’) → ‘Hello Bob!’ ‘Hello Bob!’ OK hello_name(‘Alic

2022-12-08 10:45:03 145

原创 语法练习:string_match

Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So “xxcaazz” and “xxbaaz” yields 3, since the “xx”, “aa”, and “az” substrings appear in the same place in both strings.string_match(‘xxcaazz’, ‘xxb

2022-12-07 11:26:29 316

原创 语法练习:array123

Given an array of ints, return True if the sequence of numbers 1, 2, 3 appears in the array somewhere.array123([1, 1, 2, 3, 1]) → Truearray123([1, 1, 2, 4, 1]) → Falsearray123([1, 1, 2, 1, 2, 3]) → TrueExpected Run array123([1, 1, 2, 3, 1]) → True Tru

2022-12-07 11:09:35 424

原创 语法练习:array_front9

Given an array of ints, return True if one of the first 4 elements in the array is a 9. The array length may be less than 4.array_front9([1, 2, 9, 3, 4]) → Truearray_front9([1, 2, 3, 4, 9]) → Falsearray_front9([1, 2, 3, 4, 5]) → FalseExpected Run arra

2022-12-07 11:03:32 335

原创 语法练习:array_count9

Given an array of ints, return the number of 9’s in the array.array_count9([1, 2, 9]) → 1array_count9([1, 9, 9]) → 2array_count9([1, 9, 9, 3, 9]) → 3Expected Run array_count9([1, 2, 9]) → 1 1 OK array_count9([1, 9, 9]) → 2 2 OK array_count9([1, 9, 9

2022-12-07 10:47:14 233

原创 语法练习:last2

Given a string, return the count of the number of times that a substring length 2 appears in the string and also as the last 2 chars of the string, so “hixxxhi” yields 1 (we won’t count the end substring).last2(‘hixxhi’) → 1last2(‘xaxxaxaxx’) → 1last2(‘a

2022-12-07 10:43:57 342

原创 语法练习:string_splosion

Given a non-empty string like “Code” return a string like “CCoCodCode”.string_splosion(‘Code’) → ‘CCoCodCode’string_splosion(‘abc’) → ‘aababc’string_splosion(‘ab’) → ‘aab’Expected Run string_splosion(‘Code’) → ‘CCoCodCode’ ‘CCoCodCode’ OK string_splo

2022-12-07 10:34:51 109

原创 语法练习:string_bits

Given a string, return a new string made of every other char starting with the first, so “Hello” yields “Hlo”.string_bits(‘Hello’) → ‘Hlo’string_bits(‘Hi’) → ‘H’string_bits(‘Heeololeo’) → ‘Hello’Expected Run string_bits(‘Hello’) → ‘Hlo’ ‘Hlo’ OK stri

2022-12-07 10:29:42 184

原创 语法练习:front_times

Given a string and a non-negative int n, we’ll say that the front of the string is the first 3 chars, or whatever is there if the string is less than length 3. Return n copies of the front;front_times(‘Chocolate’, 2) → ‘ChoCho’front_times(‘Chocolate’, 3)

2022-12-07 10:21:35 127

原创 语法练习:string_times

Given a string and a non-negative int n, return a larger string that is n copies of the original string.string_times(‘Hi’, 2) → ‘HiHi’string_times(‘Hi’, 3) → ‘HiHiHi’string_times(‘Hi’, 1) → ‘Hi’Expected Run string_times(‘Hi’, 2) → ‘HiHi’ ‘HiHi’ OK st

2022-12-07 10:15:39 106

原创 语法练习:front3

Given a string, we’ll say that the front is the first 3 chars of the string. If the string length is less than 3, the front is whatever is there. Return a new string which is 3 copies of the front.front3(‘Java’) → ‘JavJavJav’front3(‘Chocolate’) → ‘ChoChoC

2022-12-06 17:10:55 232

原创 语法练习:front_back

Given a string, return a new string where the first and last chars have been exchanged.front_back(‘code’) → ‘eodc’front_back(‘a’) → ‘a’front_back(‘ab’) → ‘ba’Expected Run front_back(‘code’) → ‘eodc’ ‘eodc’ OK front_back(‘a’) → ‘a’ ‘a’ OK front_back(

2022-12-06 17:05:57 520

原创 语法练习:missing_char

Given a non-empty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string (i.e. n will be in the range 0…len(str)-1 inclusive).missing_char(‘kitten’, 1) → ‘k

2022-12-06 16:59:19 216

原创 语法练习:not_string

Given a string, return a new string where "not " has been added to the front. However, if the string already begins with “not”, return the string unchanged.not_string(‘candy’) → ‘not candy’not_string(‘x’) → ‘not x’not_string(‘not bad’) → ‘not bad’Expect

2022-12-06 16:53:04 345

原创 语法练习:pos_neg

Given 2 int values, return True if one is negative and one is positive. Except if the parameter “negative” is True, then return True only if both are negative.pos_neg(1, -1, False) → Truepos_neg(-1, 1, False) → Truepos_neg(-4, -5, True) → TrueExpected R

2022-12-06 16:38:41 308

原创 语法练习:near_hundred

Given an int n, return True if it is within 10 of 100 or 200. Note: abs(num) computes the absolute value of a number.near_hundred(93) → Truenear_hundred(90) → Truenear_hundred(89) → FalseExpected Run near_hundred(93) → True True OK near_hundred(90) →

2022-12-06 16:30:01 291

原创 语法练习:makes10

Given 2 ints, a and b, return True if one if them is 10 or if their sum is 10.makes10(9, 10) → Truemakes10(9, 9) → Falsemakes10(1, 9) → TrueExpected Run makes10(9, 10) → True True OK makes10(9, 9) → False False OK makes10(1, 9) → True True OK makes

2022-12-06 16:20:31 136

原创 语法练习:parrot_trouble

We have a loud talking parrot. The “hour” parameter is the current hour time in the range 0…23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return True if we are in trouble.parrot_trouble(True, 6) → Trueparrot_trouble(

2022-12-06 15:56:15 90

原创 语法练习:diff21

Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.diff21(19) → 2diff21(10) → 11diff21(21) → 0Expected Run diff21(19) → 2 2 OK diff21(10) → 11 11 OK diff21(21) → 0 0 OK diff

2022-12-06 09:33:50 98

原创 语法练习:sum_double

Given two int values, return their sum. Unless the two values are the same, then return double their sum.sum_double(1, 2) → 3sum_double(3, 2) → 5sum_double(2, 2) → 8Expected Run sum_double(1, 2) → 3 3 OK sum_double(3, 2) → 5 5 OK sum_double(2, 2) →

2022-12-06 09:30:44 133

原创 语法练习:monkey_trouble

We have two monkeys, a and b, and the parameters a_smile and b_smile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return True if we are in trouble.monkey_trouble(True, True) → Truemonkey_trouble

2022-12-06 09:27:21 80

原创 语法练习:sleep_in

语法练习

2022-12-06 09:23:00 238

转载 Cassandra数据修复失败问题

Cassandra数据修复失败问题转自:Cassandra数据修复失败问题背景为了保证cassandra不同节点数据的一致性,需要定期进行repair操作。但是,当数据量达到一定规模时,repair操作并不简单,经常会遇到这样那样的问题,导致修复失败。本文梳理一些常见的错误,以及对应的解决办法。Some repair failed 错误执行nodetool repair keyspace table命令,可能出现如下错误信息java.lang.RuntimeException: Repair j

2021-06-02 17:25:06 578

原创 安装postgresql报错:Requires: llvm-toolset-7-clang >= 4.0.1

安装postgresql报错:Requires: llvm-toolset-7-clang >= 4.0.1问题重现安装postgresql12-devel-12.6-1PGDG.rhel7.x86_64时报错:Error: Package: postgresql12-devel-12.6-1PGDG.rhel7.x86_64 (/postgresql12-devel-12.6-1PGDG.rhel7.x86_64) Requires: llvm-toolset-7-cla

2021-06-02 10:32:45 4738 4

原创 postgresql数据库迁移timescale插件问题处理

postgresql数据库迁移timescale插件问题处理问题说明使用pg_dump进行数据库迁移后,开发人员表示在使用timescale的表时报错:ERROR: invalid INSERT on the root table of hypertable "table_name"HINT: Make sure the TimescaleDB extension has been preloaded.而其他表使用情况正常。故障排查首先确认此库下安装了timesclaedb插件:xxx

2021-05-28 16:41:01 1571

原创 returned exit status (2), expected [0]问题处理

returned exit status (2), expected [0]问题处理说明在用python编写脚本查看mha状态时遇到故障:(db_monitor) /opt/script/db_monitor # python main.pyTraceback (most recent call last): File "main.py", line 53, in <module> tunnelpkeypass = instance.tunnelpkeypass) Fil

2021-05-21 17:37:40 1364

原创 排序窗口函数区别

排序窗口函数区别规则说明row_number():依次递增排名,无重复排名rank():相同分数有重复排名,但是重复后下一个人按照实际排名dense_rank():分数一致排名一致,分数不一致排名+1NTILE(4):分组排名,里面的数字是几,最多排名就是几,里面的数字是4,最多的排名就是4...

2021-05-11 09:50:20 668

转载 linux服务器查看公网IP信息(curl)

linux服务器查看公网IP信息(curl)转自:linux服务器查看公网IP信息(curl)linux服务器查看公网IP信息的方法:命令1:curl ifconfig.me命令2:curl cip.cc命令执行效果如下图:

2020-11-02 15:35:54 1953

原创 牛客网数据库SQL实战61—— 按照dept_no进行汇总

牛客网数据库SQL实战61—— 对于employees表中,给出奇数行的first_name题目描述对于employees表中,给出奇数行的first_nameCREATE TABLE `employees` (`emp_no` int(11) NOT NULL,`birth_date` date NOT NULL,`first_name` varchar(14) NOT NULL,...

2020-05-07 15:06:51 411

原创 牛客网数据库SQL实战60—— 统计salary的累计和running_total

牛客网数据库SQL实战60—— 统计salary的累计和running_total题目描述按照salary的累计和running_total,其中running_total为前两个员工的salary累计和,其他以此类推。 具体结果如下Demo展示。。CREATE TABLE `salaries` ( `emp_no` int(11) NOT NULL,`salary` int(11) NO...

2020-05-07 14:55:31 520 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除