博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[LintCode] Nuts & Bolts Problem 螺栓螺母问题
阅读量:7072 次
发布时间:2019-06-28

本文共 1042 字,大约阅读时间需要 3 分钟。

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.

本文转自博客园Grandyang的博客,原文链接:,如需转载请自行联系原博主。

你可能感兴趣的文章
小心物联网带来的信息安全问题,政府需介入规范
查看>>
Facebook 为 iPhone 开发独立“活动”应用程序
查看>>
五类和六类网络的区别
查看>>
全云时代论调过时?边缘计算来抢饭碗
查看>>
云创大数据亮相第四届中国-亚欧安博会
查看>>
Netflix横扫了北美,却难以征服亚洲和中国
查看>>
英国批准建设KaoPark大型数据中心园区
查看>>
广州企业“掘金”万亿大数据市场
查看>>
《企业级ios应用开发实战》一2.6 在模拟器上运行应用程序
查看>>
打造智能家居的第一步:实现万物互联
查看>>
《VMware Virtual SAN权威指南(原书第2版)》一3.6 网络I/O控制配置示例
查看>>
苹果去年新增员工6000人 较前两年大幅减少
查看>>
Facebook使用Stylelint以期保证CSS代码质量
查看>>
思科Cisco Tetration Analytics平台
查看>>
高通470亿美元收购恩智浦获反垄断机构许可
查看>>
360搜索回归360母品牌 安全搜索才“靠谱”
查看>>
《stm32嵌入式系统开发实战指南》一1.2 Cortex内核系列处理器技术特点
查看>>
干掉APT的是人 不是技术
查看>>
苹果确认iOS 10存在安全漏洞
查看>>
江西推进11个 全国智慧城市试点
查看>>