行业知识
Brix面试经历与笔试题分享
2026-11-11 20:54:43
来源:互联网转载
背景介绍:Brix是一个国内管理x国外雇佣的远程办公平台,帮助入驻的工程师和有意愿的北美企业达成雇佣关系
- 笔试/算法题挑战
- 二叉树检查(中等难度)
- 矩阵转换(中等难度)
- 小括号检查(中等/困难)
- 获取字符串中非重复字符长度(困难)
- 树结构转数组(困难)
- 平台面试
- 企业面试
- 俺���强,俺也要报名!
入驻Brix平台第一轮就是笔试,我算是发现了,反正万物总将回归算法,无论你之前做的是什么领域都好,也不管你打算做什么职位,最终的朝向就是数学、算法工程师。
()笔试/算法题挑战
千篇一律的算法题挑战,共三道,时间一小时,难度可选简单/中等/困难,但我感觉没多大区别,直接上困难就行了。
个人感觉这个部分就是为了筛选掉完全不具备写代码能力的人,防止浪费人力面试。
()由于我试过了中等和困难两个级别,因此总共有5道题可做,其中有一道重复了本来应该是2*3=6道。
二叉树检查(中等难度)
该题目要求对二叉搜索树进行检查,使得所有的左节点的值都小于它所有的父节点和祖父节点,所有右节点的值都大约它所有的父节点和祖父节点。
如:
const root = { left: { left: { value: 1 }, value: 3, right: { value: 4 } }, value: 5, right: { value: 7, right: { value: 9 } }}function binarySearchTreeCheck(root) { function valid(parent, min, max) { if (min !== null && min >= parent.value) return false if (max !== null && parent.value let array = []; parens.forEach((rows, rIndex) = { rows.forEach((num, nIndex) => { if (!array[nIndex]) array[nIndex] = []; array[nIndex][rIndex] = num; }); }); return array;}小括号检查(中等/困难)
要求检查所有左右括号是否正确匹配上,如"(abc)(as)“是正确的,而”()))“,”)("是不正确的。
function quoteCheck(parens) { // 先通过正则和字符串转数组的分隔符将不是括号的项和紧靠的括号对都排除掉 let array = parens.replace(/[^\(\)|(\(\))+]+/g, "").split("()") let count = 0 while (count !== array.length) { count = array.length array = array.join("").split("()") } array = array.join("").split("") // 接着是真正的匹配,通过记录左括号的已有数量来检查,如果在左括号数量不足时出现了右括号就代表这个字符串无法完全匹配所有括号 let result = true let left = 0 for (let i = 0, l = array.length; i l - i) { break; } switch (array[i]) { case ")": if (left === 0) result = false else --left break case "(": ++left break } } // 整个字符串都匹配完后,若左括号还有剩余也是错误的 return result && left === 0}获取字符串中非重复字符长度(困难)
获取字符串里没有重复字符的子字符串长度,如abcacd中,abc是最长的无重复字符的子字符串,长度为3
int lengthOfLongestSubstring(std::string s) { size_t size = s.size(); size_t longestCount = 0; int startIndex = 0; std::unordered_map char2LastIndex; for (size_t i = startIndex; i second >= startIndex; // if already have a repeat char inside the child string, just count get the longest count and reset the child start index if (isLast || hasRepeat) { longestCount = max(i - startIndex + (hasRepeat ? 0 : 1), longestCount); if (isLast) break; startIndex = charLastIndex->second + 1; if (size - startIndex int val;std::vector}Tree_node(int val, std::vector}};std::vectorstd::vectorfor (const int val : vec) {result.push_back(val);}}return result;}
上一篇:rust怎么进自己的服务器?