array-string-practice

时间:2021-03-09 12:00:57
【文件属性】:
文件名称:array-string-practice
文件大小:4KB
文件格式:ZIP
更新时间:2021-03-09 12:00:57
Ruby 数组与字符串练习 在本练习中,您将练习使用数组和字符串来解决编码问题,然后确定解决方案的时间和空间复杂性。 尝试以最小的时间和空间复杂度编写解决方案。 不要使用以下方法: reverse reverse! 学习目标 使用循环,字符串和数组解决编码问题 确定给定方法的时间和空间复杂度 第一波-有效回文 给定一个字符串,请仅考虑字母数字字符并忽略大小写,从而确定它是否是回文。 注意:针对此问题,我们将空字符串定义为有效回文。 回文示例1 Input: "A man, a plan, a canal: Panama" Output: true 回文示例2 Input: "race a car" Output: false Wave 2-最长前缀 编写longest_prefix(strings)以在字符串数组中找到最长的公共前缀字符串。 如果没有公共前缀,则返回一个空字符串“”。
【文件预览】:
array-string-practice-master
----Dockerfile(503B)
----lib()
--------practice_exercises.rb(253B)
----Gemfile(182B)
----Rakefile(158B)
----test()
--------test_helper.rb(217B)
--------practice_exercises_test.rb(2KB)
----test.sh(18B)
----README.md(1KB)
----Gemfile.lock(647B)

网友评论