氦图面试题目Boolean search

氦图面试题目Boolean search,第1张

概述##YourpreviousPlainTextcontentispreservedbelow:###Booleansearchispowerfulinsourcingandrecruiting.#Wewillusemachinelearningpredictiontoproviderelationsamongskills.Nowweneedafunctiontotransferthoserelationstoas
# # Your prevIoUs Plain Text content is preserved below:# # # Boolean search is powerful in sourcing and recruiting.# We will use machine learning prediction to provIDe relations among skills. Now we need a function to transfer those relations to a string with correct boolean format.# # Example1:# input: [["java", "python"], ["machine learning", "deep learning"]]# output: ("java" OR "python") AND ("machine learning" OR "deep learning")# # Example2:# input: [[["java", "maven", "spring"], "python"], ["machine learning", "deep learning"]]# output: (("java" OR "maven" OR "spring") AND "python") AND ("machine learning" OR "deep learning")


// let a = [[["java", "maven", "spring"], "python"], ["machine learning", "deep learning"]]let a = [["java", "python"], ["machine learning", "deep learning"]];// [["java", "maven", "spring"], "python"]function subString(arr, dep=0){  if(arr.every((x)=>typeof x === 'string')){    return `(${arr.map(x=>`"${x}"`).join(' OR ')})`;  }    let s = arr.map(a => {    if(Array.isArray(a)){      return subString(a, 1);    }    return `"${a}"`;  }).join(' AND ');  return dep ? `(${s})` : s;}console.log(subString(a))

 

总结

以上是内存溢出为你收集整理的氦图面试题目Boolean search全部内容,希望文章能够帮你解决氦图面试题目Boolean search所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1186476.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存