天天看点

ARTS-第10周(2019.08.31)每周完成一个ARTS:(Algorithm、Review、Tip、Share, ARTS)**

每周完成一个ARTS:(Algorithm、Review、Tip、Share, ARTS)**

1.Algorithm 每周至少做一个 leetcode 的算法题-主要是为了编程训练和学习

2.Review 阅读并点评至少一篇英文技术文章-主要是为了学习英文,如果你的英文不行,你基本上无缘技术高手

3.Tip 学习至少一个技术技巧-主要是为了总结和归纳你在是常工作中所遇到的知识点

4.Share – 分享一篇有观点和思考的技术文章-主要是为了建立你的影响力,能够输出价值观

Algorithm

实现 strStr():https://leetcode-cn.com/problems/implement-strstr/

这题直接用了现成的轮子

/**
 * description
 * 实现 strStr() 函数。
 *
 * 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回  -1。
 *
 * 示例 1:
 *
 * 输入: haystack = "hello", needle = "ll"
 * 输出: 2
 *
 * 示例 2:
 *
 * 输入: haystack = "aaaaa", needle = "bba"
 * 输出: -1
 *
 * 来源:力扣(LeetCode)
 * company YH
 *
 * @Author hcc
 * modifyBy
 * createTime 2019/8/31 22:14
 * modifyTime
 */
public class ImplementStrstr28 {

    /**
     * 这里先判断是否存在包含,如果包含则求出位置,否则直接返回-1
     * @param haystack
     * @param needle
     * @return
     */
    public static int strStr(String haystack, String needle) {
        int index = -1;
        if (haystack.contains(needle)){
            index = haystack.indexOf(needle);
        }
        return index;
    }

    public static void main(String[] args) {
        System.out.println(strStr("hello","ll"));

    }
}

           

Review

Configuring Envoy to Auto-Discover Pods on Kubernetes

Tip

1.命令别人做某件事情改成说是否可以做某件事情

Share

这几道 Redis 面试题都不懂,怎么拿 Offer

继续阅读