In the first week of ARTS challenge check-in, I learned this~

Table of contents

foreword

1. Learning content

2. What to do if the timeout is over, then look at the problem solution in another way

3. Display of learning punch card results

3.1 Tips for Github

3.2 English article reading

3.3 A very good blog about Java interview questions

4. Summary of learning skills


foreword

Interpretation of ARTS
● Algorithm: Do at least one LeetCode algorithm problem every week
● Review: Read and comment on at least one English technical article
● Tips: Learn at least one technical skill
● Share: Share a technical article with opinions and thoughts

1. Learning content

In order to meet the needs of the event, I deliberately did the following things this week:

1. An algorithm question about the product of prefix and suffix

2. A foreign language journal about AIGC's transformation of smart libraries

3. Discovered a handy little trick from GitHub

4. Share a very good interview article for a small partner who is looking for an internship.

2. What to do if the timeout is over, then look at the problem solution in another way

For me who haven’t brushed the algorithm for a long time, now I want to make a problem that requires a little skill, I have no idea, and I have to use my brain often, and I still need to practice the algorithm. .

Take this topic for example:

Given an array of integers  nums, return  the array  answer , which  answer[i] is equal to  nums the  nums[i] product of the remaining elements  .

The title data  guarantees thatnums the products of all prefix elements and suffixes of any element in    the array  are within the range of 32-bit  integers.

Please do not use division and   complete this problem within the time complexity.O(n)

Normally, I usually think of two sets of for loops directly. This is my first thought, but I also know that this will definitely time out in some cases: but let’s ignore it, write it first, and then talk about it. The source code is as follows:

class Solution {
    public int[] productExceptSelf(int[] nums) {
        int sizes = nums.length;

        int answer [] = new int [sizes];
        for(int i=0;i<sizes;i++){
            answer[i] = 1;
            for(int j=0;j<sizes;j++){
                if(j!=i){
                    answer[i] *= nums[j];
                }
            }
        };
        return answer;
    }
}

The result of this operation is that only some cases can be passed: as shown below 

But I didn't expect to pass 80% of the cases in this way. Then I thought about how to make the time complexity O(n), it’s miserable, I can’t think of it, then I looked at everyone’s solution hhh, and then I remembered that I had to use the product of prefix and suffix to write, I was too stupid.

The approximate logical process is to use the prefix product and the suffix product, and then multiply the prefix product and the suffix product. The routine code is as follows:

class Solution {
    public int[] productExceptSelf(int[] nums) {
        int sizes = nums.length;
        int answer [] = new int [sizes];
        int prew = 1, next = 1;
        
        for(int i=0;i<sizes;i++){
            answer[i] = 1;
        }

        for(int i=0;i<sizes;i++){
            answer[i]*=prew;
            prew*=nums[i];

            answer[sizes-1-i]*=next;
            next*=nums[sizes-1-i];
        };
        return answer;
    }
}

 It's a pity that the time complexity is O(2n), but in a broad sense it is also O(n); so it can also pass. The above code execution process is as follows:

If nums[] = {1,2,3,4};

i = 0: ans[0] = 1*1;   prew = 1*1;   ans[3] = 1*1;   next = 1*4;

i = 1: ans[1] = 1*1*1; prew = 1*1*2; ans[2] = 1*1*4; next = 1*4*3

i = 2: ans[2] = 1*1*4*1*1*2; prew = 1*1*2*3; ans[1] = 1*1*1*1*4*3; next = 1*4*3*2

i = 3; ans[3] = 1*1*1*1*3*2; prew = 1*2*3*4; ans[0] = 1*1*1*4*3*2; next = 4*3*2*1

ans[0] = 1*1*1*4*3*2 = 24

ans[1] = 1*1*1*1*4*3 = 12

ans[2] = 1*1*4*1*1*2 = 8

ans[3] = 1*1*1*1*3*2 = 6

3. Display of learning punch card results

The above questions can also be passed:

3.1 Tips for Github

That is, if you have a front-end project, if you want to be able to see the rendering effect of the page at any time, but you don’t want to deploy it on the server, then you can create a new warehouse, and the warehouse name must end with .github.io, so that you You can put the assets directory under the dist directory generated after build into the warehouse, then when you visit this warehouse, it will directly render the effect of this project to you.

For example, I wrote a case of drawing money to send birthday red envelopes to classmates: just click on the URL of the warehouse to use it. Very convenient! (Don’t worry about the background picture, because it is set for her according to her hobbies hahaha

Pumping amount https://longstudy1.github.io/vuetest.github.io/

3.2 English article reading

Because AIGC is currently quite popular, I also found an English article about AIGC. The link is as follows:

Smart Library Transformation Research Empowered by AIGC Technology | Francis Academic PressFrancis Academic Press is one of the world’s largest publishers of peer-reviewed, fully Open Access journals. Built on an ethos of openness, we are passionate about working with the global academic community to promote open scholarly research to the world. With the help of our academic Editors, based in institutions around the globe, we are able to focus on serving our authors while preserving robust publishing standards and editorial integrity.https://francis-press.com/papers/10935

This article mainly talks about the measures and ideas of AIGC to help the library transform into a smart library. It aims to automate the library's process through artificial intelligence and graphics computing technologies, enhance user experience, improve book use efficiency and enhance user experience. Use experience.

The article also cited an example. The Raffles Library in Chongqing is a new type of smart library that uses cutting-edge technologies such as AR and VR. The library uses AIGC to recommend books and make real-time recommendations based on user behavior and preferences. This is also a very good practice. The side shows that AIGC has a lot to do, and it is still very worthy of our expectations. Hope it can be applied to more industries and bring us more surprises.

3.3 A very good blog about Java interview questions

We feel that the interview questions mentioned in this blog are very common and comprehensive. I also read them every day. There may be some knowledge points that we have not learned yet, but I think it is necessary for us to read them.

Java interview must be (required for fresh graduates)_java job interview_Shu Qiqiufeng's blog-CSDN blog agency mode. _java job interview https://blog.csdn.net/qq_45037155/article/details/128560597?spm=1001.2014.3001.5506

4. Summary of learning skills

After this week of study, I feel that I still have to read the interview questions every day, I still have to read the stereotyped essays, and I have to do at least one algorithmic question every week, otherwise my brain will always be hard to use. Then if you have time, you can also read some foreign language journals, which can not only improve our knowledge, but also train our English level. Overall it's still very nice.

Guess you like

Origin blog.csdn.net/qq_53317005/article/details/132122519