华为OD面试记录

The experience of applying for software test engineer(Dispatcher)

记录保存

招聘岗位: 测试工程师

Base:西安

华为面试流程如下:

流程名内容
机试三题,总分400分,最后一道题200分
人力资源面试询问私人问题,不谈薪资
一面技术面
二面技术面
主管问项目
提交文件背景调查

机试题:

  1. 字符串找到最小无重复子串(最大),输出其数量。
    经典题,面试题也出现过一次,由此可见这道题基本上算是必考范畴.

解法:

/**
 * @file GetMaxLengthOfSubstring.cpp
 * @author zhanggao
 * @brief 基于双指针的寻最大子串算法
 * @version 0.1
 * @date 2023-08-02
 * 
 * @copyright Copyright (c) 2023
 * 
 */
#include <iostream>

// double ptr
using namespace std;
/**
 * @brief 判断子串是否包含重复值
 * 
 * @param target 重复值
 * @param characterString 子串 
 * @param front 指向子串的头指针
 * @param tail 指向子串的尾指针
 * @return int 若不存在返回0,存在返回下标
 */
int isInclude(const char &target, const char *characterString, const int &front,
              const int &tail);

int main() {
  char *s; // input
  int front = 0, tail = 0, maxLength = 0, length, temp;
  cin >> s; // index for the first and end
  // double ptr method, front for the 1st of substring, tail for the last of
  for (int index = 1; s[index] != '\0';
       index++) { // iterate all elements of the string
    temp = isInclude(s[index], s, front, tail);
    if (temp > 0) { // check if include the target(it)
      front = temp;  // add the index until *it is not in the substring;
    }
    tail++; // forward to behind
    length = tail - front + 1; // get the current length
    maxLength = length > maxLength
                    ? length
                    : maxLength; // compare with the previous the maxlength
  }
  cout << maxLength << endl;
  return 0;
}

int isInclude(const char &target, const char *characterString, const int &front,
              const int &tail) {
  for (int i = front; i <= tail; i++) { // check if is include
    if (characterString[i] == target) {
      return i + 1;
    }
  }
  return 0;
}
  1. 括号对称,用栈方式进行解决
bool isSymmetric(string s) {
  char *stack = s.data();
  char a;
  int index = 0;
  for (int i = 0; i < s.length(); i++) {
    a = s[i];
    if (index > 0 && (stack[index - 1] + 1 == a || stack[index - 1] + 2 == a)) {
      stack[index - 1] = 0;
      index--;
    } else {
      stack[index] = a;
      index++;
    }
  }
  return stack[0] == 0;
}
  1. 给你一系列数值,依次构建成树,输入null的为叶节点。返回其树的最左数据节点和最右数据节点的距离(意为中间有多少个数据节点)

输入:root = [1,3,2,5,0,0,9,6,0,7]
输出:7
解释:宽度为 7 (6,null,null,null,null,null,7) 。

/**
 * @file distance_between_leftest_point_and_rightest_point.cpp
 * @author ZhangGao
 * @brief 用队列保存其状态即可
 * @version 0.1
 * @date 2023-08-03
 * 
 * @copyright Copyright (c) 2023
 * 
 */
#include <iostream>
#include <queue>
using namespace std;
int main() {
  int target;
  bool status = true;
  queue<int> statusQueue;
  cin >> target;
  statusQueue.push(target);
  while (cin >> target) {
    while (statusQueue.front() == 0) {
      statusQueue.push(0);
      statusQueue.push(0);
      statusQueue.pop();
    }

    statusQueue.push(target);
    status = !status;
    if (status) {
      statusQueue.pop();
    }
  }
  if(!status){
	statusQueue.pop();
  }
  cout << statusQueue.size();
  return 0;
}

面试题:

一面面试官询问项目问题:
Q:

项目中推算出眼睛度数的算法是什么?

A:

根据焦距进行倒数后推算出的,焦距可通过远点测距法来算出

Q:

项目的架构是什么?

A:

前端使用的是Vue框架(View Layer)进行开发,然后后端是由Nginx作为负载中间件(也可以称其为WEB服务器应用),Flask(WEB应用框架,Controller Layer),Redis作为缓存中间件(用于放进)

手撕算法题:

删除给出链表中的重复元素(链表中元素从小到大有序),使链表中的所有元素都只出现一次.例如:
给出的链表为1->1->1->2,返回1->2.
给出的链表为1->2->3->3,返回1->2->3.

进阶:空间复杂度O(1),时间复杂度 O(n)

/**
 * struct ListNode {
 *  int val;
 *  struct ListNode *next;
 *  ListNode(int x) : val(x), next(nullptr) {}
 * };
 */
#include <cstdlib>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param head ListNode类
     * @return ListNode类
     */
    ListNode* deleteDuplicates(ListNode* head) {
        // write code here
        int temp=-101;//用来保存值
        ListNode* tempNode=nullptr;
        ListNode* cursor = head;
        while(cursor!=nullptr){
            if(cursor->val!=temp){//确保其不等于
                temp=cursor->val;//更新值
                tempNode=cursor;//先保存其更新的节点
                cursor=cursor->next;//迭代
            }
            else{
                tempNode->next=cursor->next;//synaxIndexException,设置更新的节点链接重复值节点的下一个节点
                delete cursor;
                cursor=tempNode->next;//访问下个节点
            }
        }
        return head;
    }
};

二面面试官:

  1. 三次握手四次挥手

SYN报文 SYN+ACK报文和ACK报文
FIN报文 ACK报文 FIN报文和ACK报文

  1. 红黑树五大原理

红黑树其实就是一种AVL平衡二叉树

根可以是红色也可以是黑色,但基本上叶节点是黑色

红节点的子节点都是黑色,换句话说红节点不能互为父子关系,

每个路径的黑色节点数量都相同。区别在于红色节点是否多。

全为黑色节点的路径是最短路径,最长路径是差不多有黑色节点一样数量的红色节点:最长路径不超过最短路径*2

  1. 测试了解程度

我当时把测试框架说了一遍后也说了测试有很大范畴,首先是从角度来分类可以分成黑盒测试和白盒测试,其中黑盒测试有边界值划分,等价类划分,正交表,基于场景分析,黑盒测试和白盒测试区别在于一个是否查看内部细节,执行测试过程中基本以黑盒测试为主要,白盒测试为辅。
如果是从软件过程角度来思考可以分成问题定义 可行性分析 需求分析 总体设计 详细设计 单元测试 集成测试 系统测试 确认测试 验收测试,这些步骤是

  1. 数据库的基本操作增删改查

create update select delete

  1. 基本命令行应用
    因为我是windows和linux都有所涉及,因此回答该问题时候我直接给面试官打出一系列命令:
    Windows: tasklist taskkill type cd move del chdir rmdir dir net netstat ipconfig clip copy findstr etc…
    Linux: ls pwd cd ps rm rmdir cat tail vm grep nslookup man etc…
    常见命令工具(第三方): vim ssh sftp
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

长高

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值