奇安信 4.1 前端笔试

第一题AC
import java.util.*;
 
public class Main{
    public static int totalsize = 0;

    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int n  = sc.nextInt();
        sc.nextLine();
        String[] nlist = sc.nextLine().split(" ");
        List<List<String>> res = new ArrayList<List<String>>();
        List<String> siout = new ArrayList<String>();
        for(int i = 0; i< n; i++){
            siout.add(nlist[i]);
        }
        bt(n,res,siout,0);
       System.out.println(totalsize);
    }
    public static void bt(int s,  List<List<String>> res, List<String> siout,int first){
        if(first == s){
            if(siout.indexOf("A")<siout.indexOf("B")){
                totalsize++;
                int l = siout.size();
                int total = 0;
                    for(String le: siout){
                        total++;
                        if(total<l){
                             System.out.print(le);
                             System.out.print("-");
                        }
                        else{
                            System.out.print(le);
                        }
            
                        }
                System.out.print(" ");
            }
          
        }
        for(int i = first; i< s;i++){
            Collections.swap(siout,first,i);
            bt(s,res,siout,first+1);
            Collections.swap(siout,first,i);
        }
    }
}
第二题没时间做了。

#奇安信##笔经#
全部评论
第一题车辆类型组合,第二题已知长宽高和求最大体积
点赞 回复
分享
发布于 2021-04-01 17:20
第一题是自行车吗?我后端也是这道
点赞 回复
分享
发布于 2021-04-01 17:32
阅文集团
校招火热招聘中
官网直投
第二题用质数筛+三指针,第一题为什么我不懂题意啊?难道不是dfs全排列+特判? 写了半天0% 郁闷
点赞 回复
分享
发布于 2021-04-01 17:37
请问他们公司前端笔试是可以用java吗?
点赞 回复
分享
发布于 2021-04-13 16:42
全AC至今都还没约面试
点赞 回复
分享
发布于 2021-04-20 00:01

相关推荐

1 5 评论
分享
牛客网
牛客企业服务