• 记一次专业面试公司的视频电话面试 2019-Feb-24


    时代进步了, 周末也可以约面试, 不用请假去面试。现在有专业的面试公司帮助雇主进行面试.

    We've partnered with Kxxxx  to conduct this portion of our hiring process because they give you great scheduling flexibility (nights and weekends),
    offer a no-questions-asked Redo Opportunity and they're experts at delivering fair, unbiased assessments.

    既然他们可以提供重做一次, 我明天发邮件申请再来一个面试. 我的目的就是未来练习面试. 多好的机会.

    今天电话面试主菜, 我只做到第二道题. 应该还有第三道,第 4 道.

    第一道题目是模拟枚举类. 分类统计每个域名的访问次数. 比如:

    输入:

    aa.bb.com : 10

    bb.com : 20

    cc.com : 80

    com 100

    返回结果:

    aa.bb.com : 10

    bb.com = aa.bb.com + bb.com = 10 + 20 = 30

    com : 100 + 10 + 20 + 80 = 210

    第2道题是求两个数组的最长公共子序列,咱没有系统的学动态规划,没有做出来,看了答案十几分钟看懂了。

    https://www.lintcode.com/problem/longest-common-subsequence 原题.

    思路: 动态规划, 可以用滚动数组优化空间复杂度.

    转移方程: 如果前一个元素相同, 当前长度加一; 如果不等, 取前面的两种情况的最长的.

    def longestCommonSubsequence(self, A, B):
            m, n = len(A), len(B)
            f = [[0] * (n + 1) for _ in range(m + 1)]
            for i in range(1, m + 1):
                for j in range(1, n + 1):
                    if A[i - 1] == B[j - 1]:
                        f[i][j] = f[i - 1][j - 1] + 1
                    else:
                        f[i][j] = max(f[i][j - 1], f[i - 1][j])
            return f[m][n]

    Variant 本题有一点包装或者迷惑. 数组是一些单词, 返回最长的公共单词序列:

     1 class Solution:
     2     """
     3     @param A: A string
     4     @param B: A string
     5     @return: The length of longest common subsequence of A and B
     6     """
     7     def longestCommonSubsequence(self, A, B):
     8         res = ""
     9         m, n = len(A), len(B)
    10         f = [[0] * (n + 1) for _ in range(m + 1)]
    11         fs = [[""] * (n + 1) for _ in range(m + 1)]
    12         for i in range(1, m + 1):
    13             for j in range(1, n + 1):
    14                 if A[i - 1] == B[j - 1]:
    15                     f[i][j] = f[i - 1][j - 1] + 1
    16                     fs[i][j] = fs[i - 1][j - 1] + A[i - 1]
    17                 else:
    18                     f[i][j] = max(f[i][j - 1], f[i - 1][j])
    19                     if f[i][j - 1] > f[i - 1][j]:
    20                         fs[i][j] = fs[i][j - 1]
    21                     else:
    22                         fs[i][j] = fs[i - 1][j]
    23         return fs[m][n]
    24 
    25 
    26 o = Solution()
    27 A = "abcfd"
    28 B = "eacbf"
    29 
    30 ans = o.longestCommonSubsequence(A, B)
    31 print(ans)

    今天还问了一些概念题都是我的短板,谁帮忙给答一下。

    Composition and inheritance. 面向对象设计它们之间的差别是什么?各自的优缺点是什么? 能举个例子吗?
    What is dependency injection? 也能举个例子吗?

    概念题有5类,
    产品,前端,操作系统,面向对象,还有测试, 我都不行,就选了操作系统和面向对象。
    下回我试试产品和测试。

  • 相关阅读:
    如何正确记忆单词
    转:超级通用型分页存储过程
    Delphi报表开发ReportMachine的小计和总计的计算
    DELPHI编程用SQLDMO呈现带进度条的SQL Server数据库Databnse备份!
    datasnap 2010 心跳包,连接断开处理
    合并BPL包图文教程
    Borland DataSnap(MIDAS)三层架构编程中,主细表的处理方式
    网上摘的 杀进程函数
    为RB定制支持参数的自定义函数
    获取一个数据库中的所有表的名称、一个表中所有字段的名称
  • 原文地址:https://www.cnblogs.com/goodwish/p/10428989.html
Copyright © 2020-2023  润新知