Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTS 第十周(2019.11.18-2019.11.24) #10

Open
caimel opened this issue Dec 8, 2019 · 0 comments
Open

ARTS 第十周(2019.11.18-2019.11.24) #10

caimel opened this issue Dec 8, 2019 · 0 comments

Comments

@caimel
Copy link
Owner

caimel commented Dec 8, 2019

Algorithm 验证回文字符串

  • 题目: 验证回文字符串
  • 思路:
    使用正则表达式提取字符串中的字母和数字,将其全部转换成小写,然后转成数组。
    使用双引用从数组两端往中间一一比较,一旦出现不等的情况直接返回false。否则为true
/**
 * @param {string} s
 * @return {boolean}
 */
var isPalindrome = function(s) {
     if(s==""||s==null) return true;
        let str = s.replace(/[^a-z0-9]/ig, '');
        str = str.toLocaleLowerCase();
        str = str.split('');
        let l = 0;
        let r = str.length-1;
        while(l<r){
            if(str[l]+'' !== str[r]+''){
                 return false; 
            }
            else {
                l++;
                r--;
            }
        }
        return true;
    
};
  • 结果:476 / 476 个通过测试用例
    执行用时:80 ms

Review 理解 Nodejs 中的 Web Sockets

https://medium.com/swlh/web-sockets-in-node-js-f3b3a4abcbe3

  • 复述: 该文章先解释 Web Sockets与HTTP的区别,引出 Web Sockets实现服务端和客户端端可以同时传输数据。Socket I.O 具有非常类似于WebSocket API的API,它具有许多功能,例如广播,易失性消息等等, 通过创建服务器每秒不断调用一次tick()函数,以通知服务器所有连接的客户端的时间的实例帮助读者理解NodeJS中的Web Sockets的实现。

Tip 关于React Native中FlatList的onEndReached属性频繁调用的一种解决办法

https://www.cnblogs.com/carbo-T/p/10330474.html

Share React 性能优化,你需要知道的几个点

https://www.jianshu.com/p/333f390f2e84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant