当前位置:网站首页>Interview questions of a company in a certain month of a certain year (1)

Interview questions of a company in a certain month of a certain year (1)

2022-06-23 07:49:00 Witty flowers

One 、 front end

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>yellow</title>
</head>
<style>
    #t1 {
        background-color: red;
        width: 500px;
        height: 500px;
        text-align: center;
        line-height: 50px;
        float: left;
    }

    #t2 {
        background-color: rebeccapurple;
        width: 300px;
        height: 300px;
        margin: 100px 100px;
        text-align: center;
        line-height: 50px;
        float: left;
        cursor: pointer;
    }

    #t3 {
        background-color: chartreuse;
        width: 100px;
        height: 100px;
        margin: 100px 100px;
        text-align: center;
        line-height: 260px;
        float: left;
        cursor: pointer; /* Little hands */

    }
</style>
<script src="js/jquery-3.3.1.js"></script>
<script>
    // alert(111)
    $(function () {
        var colorArr = ['rebeccapurple', 'yellow'];
        var count = 1;

        $("#t2").click(function () {
            var $this = $(this);
            $this.css('backgroundColor', colorArr[count % 2]);
            count++;
        })
    })

    $(function () {
        var colorArr = ['chartreuse', 'blue'];
        var count = 1;

        $("#t3").click(function () {
            var $this = $(this);
            $this.css('backgroundColor', colorArr[count % 2]);
            count++;
        })
    })

</script>
<body>

<div id="t1">
    <div id="t2">
        <div id="t3">
             Third form 
        </div>
         Second form 
    </div>
     First table 
</div>


</body>
</html>

Two 、 Back end

 

/**
 * @Author wang
 * @Date 2022/6/19 12:10
 * @PackageName:PACKAGE_NAME
 * @ClassName: findDifferent
 * @Description: TODO 2、	 Write a piece of code , Find out several inconsistencies in the following text ( Assuming the same number of words , Consecutive mistakes in words count as one item , There should be 3 Different , Write the code implementation ):
 * TODO  The same length does not require double for  Different lengths require double repetition for
 * @Version 1.0
 */

import javax.lang.model.SourceVersion;
import javax.lang.model.element.VariableElement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

/**
 *  Object oriented thinking has been involved in all aspects of software development . Such as , Object oriented analysis (OOA,Object OrientedAnalysis) , Object oriented design (oOD,Object Oriented
 * Design) 、 And what we often call object-oriented programming implementation (OOP,ObjectOriented Programming) .
 * <p>
 * <p>
 *  The idea of object-oriented has been designed to all aspects of software development . Such as : Object oriented analysis (OOA,Object OrientedAnalysis) ,
 * Design) 、 And what we often call object-oriented programming (OOP,ObjectOriented Programming) .
 */
public class findDifferent {
    public static void main(String[] args) {
//        oneVoid(); //1- Make a difference 

//        Scanner sc = new Scanner(System.in);//2- Input string   Find the same 
//        String s1 = sc.nextLine();
//        String s2 = sc.nextLine();
//        String search = search(s1, s2);
//        System.out.println("search = " + search);

    }

    /**
     *  The third way   Use hashmap
     */


    


    /**
     *  The second method   Use scanner  Input  list Store value 
     */

    public static String search(String str1, String str2) {
        char[] str1s = str1.toCharArray();

        List list = new ArrayList<>();
        String temp = "";
        for (int i = 0; i < str1s.length; i++) {
            if (!list.contains(str1s[i])) {
                list.add(str1s[i]);
                temp += str1s[i];
            }

        }
        char[] tempChars = temp.toCharArray();
        char[] str2Chars = str2.toCharArray();

        String tempChar = "";
        for (int j = 0; j < temp.length(); j++) {
            for (int k = 0; k < str2Chars.length; k++) {
                if (tempChars[j] == str2Chars[k]) {
                    tempChar += tempChars[j];
                    break;
                }
            }
        }

        return tempChar;

    }


    /**
     *  The first method 
     */
    public static void oneVoid() {
        String str1 = " Object oriented thinking has been involved in all aspects of software development . Such as , Object oriented analysis (OOA,Object OrientedAnalysis) ,Design) 、 And what we often call object-oriented programming implementation (OOP,ObjectOriented Programming) .";
        String str2 = " The idea of object-oriented has been designed to all aspects of software development . Such as : Object oriented analysis (OOA,Object OrientedAnalysis) ,Design) 、 And what we often call object-oriented programming (OOP,ObjectOriented Programming) .";


        //1、 First   obtain 2 Characters are missing   length 
        int length1 = str1.length();
        int length2 = str2.length();

        //2、 use SubString  Intercept   Compare one by one 
        for (int i = 0; i < length1; i++) {
            char c = str1.charAt(i);
            char c1 = str2.charAt(i);
            if (c != c1) {
                System.out.println("c1 = " + c1);
            }
        }
    }
}

3、 ... and 、 Insufficient

In the front question I wrote that there are bug Of Just click on the third div When the second div It will change  

In the back end question It can be used HashMap The value of stored value is ( Brother Xu reminded me ) I didn't realize it when I finished  

Learning together The big guy passing by gave me some advice

原网站

版权声明
本文为[Witty flowers]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230708253107.html