ARTS 打卡第一周

Algorithm

初识leetcode网站,是参加了覃超的《算法训练营》的小课训练。视频中,覃老师在课堂上介绍了“五毒神掌”的算法学习方法:
1.先花5-10分钟读题,然后去思考答案。如果暂时没思路,不要紧,直接看题解。
2.自行题解。使用多种方法尝试,直到速度优化到最佳。
3.看leetcode中前三的解法。
4.一周后重新解题。
5.较长时间后(如面试前)重新解题。

本次Leetcode题目是:给定一个整数,将其转为罗马数字。输入确保在 1 到 3999 的范围内。

链接:https://leetcode-cn.com/problems/integer-to-roman

解题思路:

1.枚举法

将所有可能的情况列出:将4位整数拆分成 个十百千,然后分别找对应的数字即可。

    public String intToRoman(int num) {

        String [] one = {"I","II","III","IV","V","VI","VII","VIII","IX","X"};

        String [] two = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC","C"};

        String [] three ={"C","CC","CCC","CD","D","DC","DCC","DCCC","CM","M"};

        String [] four = {"M","MM","MMM"};

        String result=new String();

        int a ;

        a= num/1000;

        if (a>0){

            result =result+ four[a-1];

            num=num%1000;

        }

        a = num/100;

        if(a>0){

            result = result+three[a-1];

            num=num%100;

        }

        a = num/10;

        if(a>0){

            result = result+two[a-1];

            num=num%10;

        }

        a=num%10;

        if(a>0){

            result=result+one[a-1];

        }

        return result;

    }

2.贪心算法

对于一个具体问题,要确定它是否具有贪心选择的性质,我们必须证明每一步所作的贪心选择最终能得到问题的最优解

对于本题而言,如果将罗马数字看成是钞票,尽量能通过少给对方钞票数量的方式(除了4,9类的)实现对金额的拆分

    public String intToRoman(int num) {

     // 把阿拉伯数字与罗马数字可能出现的所有情况和对应关系,放在两个数组中

        // 并且按照阿拉伯数字的大小降序排列,这是贪心选择思想

        int[] nums = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};

        String[] romans = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};

 

        StringBuilder stringBuilder = new StringBuilder();

        int index = 0;

        while (index < 13) {

            // 特别注意:这里是等号

            while (num >= nums[index]) {

                // 注意:这里是等于号,表示尽量使用大的"面值"

                stringBuilder.append(romans[index]);

                num -= nums[index];

            }

            index++;

        }

        return stringBuilder.toString();

Review

Tableau expands AWS partnership with new cloud migration initiative

The aim is to help enterprises adopt a cloud-based analytics strategy by migrating data and analytics workloads to AWS

Tableau is expanding its partnership with Amazon Web Services with the launch of a new initiative called Modern Cloud Analytics (MCA), the companies announced Tuesday. In a nutshell, MCA combines AWS's scale and infrastructure performance with Tableau's migration, integration and analytics tools. The aim is to help enterprises adopt a cloud-based analytics strategy by migrating data and analytics workloads to AWS.

MCA extends and builds on existing integrations between Tableau and AWS, including native data connectors to services like Amazon Redshift and Amazon Athena as well as AWS Quick Start deployment guides. 

The companies are pitching MCA as a set of guiding principles and proven migration methodologies that will help customers as they deploy self-service analytics in the cloud.

"Organizations must continuously evaluate their data strategy to remain competitive and deliver impactful customer experiences," said Doug Yeum, head of worldwide channels and alliances for AWS. "We're delighted to evolve our longtime strategic relationship with Tableau to further provide customers with unique, integrated solutions and a proven enterprise cloud platform as they modernize their analytics capabilities."

The first phase of MCA is focused on helping customers migrate workloads to AWS. Launch partners InterWorks, Slalom and TEKsystems, which each offer established MCA-based programs to aid customers in the migration process. 

In separate announcements, Tableau -- which was acquired by Salesforce for $15.7 billion -- announced a series of key partner integrations and the launch of a redesigned partner network. 

The integrations include new connectors for deploying Tableau servers on Alibaba's cloud; an integration with Alteryx via Tableau's Hyper API for inputting large data files; and a new extension with DataRobot that lets joint customers publish AI predictions as an accessible Tableau data source. 

Tableau also announced new integrations with cloud analytics company Kyvos, location data company Mapbox, AI software maker Narrative Science, data processing player Qubole, and data warehouse provider Yellowbrick. 

The new Tableau Partner Network is broken out into three tracks – Reseller, Services and Technology –  which Tableau said are aligned with its core partner business models. Additionally, new requirements are being introduced to certify partner expertise across major customer areas. 

Tableau推出了一个MCA的计划,将 AWS 的规模和基础设施性能与 Tableau 的迁移、集成和分析工具相结合。

Tip

在vscode上提交leetcode

(1)安装VScode

(2)安装npm

(3)安装java extension pack

(4)安装leetcode插件

(5)设置登录leetcode的用户名和密码

(6)打开leetcode题目,右键点show problem

(7)编码

(8)右键点test in leetcode, summit to leetcode

OK.


Share

孙玄:基于CAP模型设计企业级真正高可用的分布式锁

https://mp.weixin.qq.com/s/43EZMS5bPifICjSGM8G47g

为什么说金融科技公司应该迁移到微服务架构?

https://www.infoq.cn/article/6CCRC3R6fMbp6mQPixPq

乔梁:DevOps之十倍速原则

https://mp.weixin.qq.com/s/YI0SxaVBKdf9cIk8bb4O4g

To be continued...

你可能感兴趣的:(ARTS)