zoukankan      html  css  js  c++  java
  • [LintCode] Nuts & Bolts Problem 螺栓螺母问题

    Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means nut can only be compared with bolt and bolt can only be compared with nut to see which one is bigger/smaller.

    We will give you a compare function to compare nut with bolt.
    Have you met this question in a real interview?
    Example

    Given nuts = ['ab','bc','dd','gg'], bolts = ['AB','GG', 'DD', 'BC'].

    Your code should find the matching bolts and nuts.

    one of the possible return:

    nuts = ['ab','bc','dd','gg'], bolts = ['AB','BC','DD','GG'].

    we will tell you the match compare function. If we give you another compare function.

    the possible return is the following:

    nuts = ['ab','bc','dd','gg'], bolts = ['BC','AA','DD','GG'].

    So you must use the compare function that we give to do the sorting.

    The order of the nuts or bolts does not matter. You just need to find the matching bolt for each nut.

  • 相关阅读:
    03-spring bean
    04-spring的依赖注入
    01-课程安排
    17-注解开发
    WIN10新机必要设置记录 for 3dsmax
    ps导出svg
    VS C# 共享项目
    在Maxscript中创建.Net类型
    C# 自定义索引
    C# ?
  • 原文地址:https://www.cnblogs.com/grandyang/p/5833107.html
Copyright © 2011-2022 走看看