博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
记一次面试笔试题
阅读量:5848 次
发布时间:2019-06-19

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

  • 面试题是全英文的,但单词都比较熟悉算是好理解,而且有案例。所以,稍微细心一点是完全可以避免的,这里写下题目,以及解题过程。

  • 题:

If you think the description is incomplete and affect the answers in any way, please make appropriate assumption and describe it in the answer·         We are a PHP shop and prefer you answering in PHP. But you might answer in any other languages in case you are not familiar with it, we accept answers in C#, Java, Javascript, Python, Perl, C++, Ruby, etc.Problem StatementThe input is an English sentence as a string, we need a function - “function convert($input)” that can transform it as described below and return a new string.The sentence would contain only alphabet (a-z and A-Z) and space, each word would be separated by exactly one space. There would be no spaces before and after the sentence.Please return the string with each word spelled in reverse, however, the position of the capitalization of each letter should stay the same for each word.For example:Input: Many people spell MySQL incorrectlyOutput: Ynam elpoep lleps LqSYM yltcerrocni复制代码
  • 解:
$string = 'Many people spell MySQL incorrectly';function myStrrev($string){    $paterrn = '/^([a-zA-Z]){1,100}((\s){1}([a-zA-Z]){1,100})*$/'; //假设一个单词最大范围1-100    if(preg_match($paterrn,$string)) {        $data = explode(' ',$string);         foreach($data as $key => $value){            $newValue = strtolower(strrev($value));            for($i=0;$i
  • 不管是开发也还,还是做题也好。正确理解题目永远是最关键的,心里毒打自己一百遍!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

转载地址:http://gckjx.baihongyu.com/

你可能感兴趣的文章
白帽子技术分析会话劫持实战讲解
查看>>
我的友情链接
查看>>
yum的三种方式
查看>>
Redis分布式缓存安装和使用
查看>>
PHP环境搭建:Windows 7下安装配置PHP+Apache+Mysql环境教程以及注意事项
查看>>
20天精通 Windows 8:系列课程资料集
查看>>
html5 <figure> 标签
查看>>
linux的I/O多路转接select的fd_set数据结构和相应FD_宏的实现分析
查看>>
Mysql数据库InnoDB存储引擎的隔离级别
查看>>
开源监控软件 Hyperic 的两种插件
查看>>
TOMCAT
查看>>
无土栽培中的物联网技术应用
查看>>
div contenteditable="true"各个浏览器上的解析
查看>>
Spark学习记录(二)Spark集群搭建
查看>>
Python基本数据类型之字典
查看>>
php引用(&)详解及注意事项
查看>>
OSChina 周一乱弹 —— 只要给网,这种生活我能过一辈子
查看>>
短信猫JAVA二次开发包SMSLib,org.smslib.TimeoutException: No response from device解决方案...
查看>>
CloudStack 4.4学习总结之cloudstack-management安装
查看>>
【动弹有奖】——OSC登录并发送动弹分析(附python源码)
查看>>