ARTS-Week003

Algorithm

本周Leetcode算法题:

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Example 1:

1
2
3
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.

Example 2:

1
2
Input: "cbbd"
Output: "bb"

解答详情:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    class Solution {
public String longestPalindrome(String s) {

int sLen = s.length();
if(s.length() <= 1){
return s;
}

int maxPalindrome = 1;
String maxPalindromeStr = s.substring(0, 1);
boolean dp [][] = new boolean [sLen][sLen];

//动态规划
for(int r = 1; r < sLen; r++){
for(int l = 0; l < r; l++){
if( s.charAt(l) == s.charAt(r)
&& ( (r -l <= 2) || dp[ l + 1 ][r - 1])){
dp[l][r] = true;
if( r - l + 1 > maxPalindrome){
maxPalindrome = r - l + 1;
maxPalindromeStr = s.substring(l, r + 1);
}
}
}
}
return maxPalindromeStr;
}
}

Review

https://medium.com/netflix-techblog/how-data-inspires-building-a-scalable-resilient-and-secure-cloud-infrastructure-at-netflix-c14ea9f2d00c

博文讲述了Netflix围绕数据建立的基础架构体系工程实践经验

Tip

背景: 项目认证使用Oauth2授权码模式出现500

现象: user must be authenticated with spring security before authorization can be completed.

解决: 参考https://stackoverflow.com/questions/28322392/spring-security-oauth2-insufficientauthenticationexception?rq=1

Sharing

对于微服务的思考

https://www.infoq.cn/article/3hFNrcoA4i6xfpEg_0Vt