后端工程师-软件类OPPO-2023届校园招聘笔试题-后端(A卷)
生活随笔
收集整理的這篇文章主要介紹了
后端工程师-软件类OPPO-2023届校园招聘笔试题-后端(A卷)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
編程題1 AC
import java.util.Arrays;public class Solution {/*** 代碼中的類名、方法名、參數名已經指定,請勿修改,直接返回方法規定的值即可*** @param digits int整型一維數組* @return int整型*/public int maxDigit (int[] digits) {// write code hereArrays.sort(digits);int ans = 0;for (int i = digits.length - 1; i >= 0; i--) {ans = ans * 10 + digits[i];}return ans;} }編程題2AC
import java.util.*;/** public class ListNode {* int val;* ListNode next = null;* public ListNode(int val) {* this.val = val;* }* }*/public class Solution {/*** 代碼中的類名、方法名、參數名已經指定,請勿修改,直接返回方法規定的值即可*** @param node1 ListNode類* @param node2 ListNode類* @return ListNode類*/public ListNode combineTwoDisorderNodeToOrder (ListNode node1, ListNode node2) {// write code hereList<ListNode> lists = new ArrayList<>();getListNodeToLists(node1, lists);getListNodeToLists(node2, lists);lists.sort((ListNode a, ListNode b) -> {return a.val - b.val;});return getSortListNode(lists);}public void getListNodeToLists(ListNode head, List<ListNode> lists) {while(head != null) {ListNode next = head.next;head.next = null;lists.add(head);head = next;}}public ListNode getSortListNode(List<ListNode> lists) {ListNode head = new ListNode(0);ListNode cur = head;for (int i = 0; i < lists.size(); i++) {cur.next = lists.get(i);cur = cur.next;}return head.next;} }編程題3AC
import java.util.*;public class Solution {/*** 代碼中的類名、方法名、參數名已經指定,請勿修改,直接返回方法規定的值即可** * @param scenicspot int整型 * @return long長整型*/public long tourismRoutePlanning (int scenicspot) {// write code hereif (scenicspot == 1)return 1L;if (scenicspot == 2)return 2L;long[] dp = new long[scenicspot];dp[0] = 1L; dp[1] = 2L;for (int i = 2; i < scenicspot; i++)dp[i] = dp[i-1] + dp[i-2];return dp[scenicspot - 1];} }
三道題的難度都很簡單,不知道這個崗位是不是不招人了
總結
以上是生活随笔為你收集整理的后端工程师-软件类OPPO-2023届校园招聘笔试题-后端(A卷)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jQuery-fancybox图片预览
- 下一篇: ArcGIS Pro2.7 导入obj模