HCL面试问题可以任何人说出解决方案

编程入门 行业动态 更新时间:2024-10-22 22:50:26
本文介绍了HCL面试问题可以任何人说出解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有一个数组随机包含数字Ex:arr [6] = {43,46,54,2,65,75}; 总和在304,所以突然有一个元素会变成零如何找到 哪个元素变为零,我们也必须找到地址。

Have an array it contain number random Ex: arr[6] ={43,66,54,2,65,75}; There sum in 304, so suddenly one element will become zero how to find which element has become zero and we have to find the address also.

推荐答案

sandeep写道: sandeep wrote: 有一个数组,它包含数字随机Ex:arr [6] = {43,66,54,2 ,65,75}; 总和在304,所以突然一个元素将变为零如何找到 哪个元素已经变为零,我们也必须找到地址。 Have an array it contain number random Ex: arr[6] ={43,66,54,2,65,75}; There sum in 304, so suddenly one element will become zero how to find which element has become zero and we have to find the address also.

首先,数组的总和不是304的305. 假设总和为305,则遍历数组检查 为零并使用索引返回地址。简单:) -kondal

First the sum of the array is not 304 its 305. Assuming that the sum would be 305, traverse through the array checking for zero and return the address using the index. Its simple :) -kondal

kondal写道: kondal wrote: sandeep写道: sandeep wrote: 有一个数组,它包含数字随机Ex:arr [6] = {43, 66,54,2,65,75}; 总和在304,所以突然一个元素将变为零如何找到 哪个元素变为零并且我们有找到地址也。 Have an array it contain number random Ex: arr[6] ={43,66,54,2,65,75}; There sum in 304, so suddenly one element will become zero how to find which element has become zero and we have to find the address also.

首先,数组的总和不是304的305. 假设总和为305,则遍历数组检查 为零并使用索引返回地址。它的简单:) -kondal

First the sum of the array is not 304 its 305. Assuming that the sum would be 305, traverse through the array checking for zero and return the address using the index. Its simple :) -kondal

你的意思是说像轮询方法(反复检查完整阵列 方法)但是面试官告诉我使用其他逻辑

You mean to say like polling method ( repeatedly checking full array method ) but the interviewer told me to use other logic

sandeep写道: sandeep wrote: 有一个数组,它包含数字随机Ex:arr [6] = {43,46,54,2,65,75}; 总和在304,所以突然一个元素将成为零如何找到 哪个元素已经变为零,我们也必须找到地址。 Have an array it contain number random Ex: arr[6] ={43,66,54,2,65,75}; There sum in 304, so suddenly one element will become zero how to find which element has become zero and we have to find the address also.

首先,什么是HCL访谈? 其次,为了使总和为304,其中一个元素需要 减少1,而不是设为零。 /> 找到一个值为零的元素会很容易,就像 找到它的地址一样,但我不知道304与任何东西有什么关系。

First, what is an HCL interview? Second, in order for the sum to be 304, one of the elements would need to be reduced by 1, not set to zero. Finding an element with the value of zero would be easy, as would finding its address, but I don''t see what 304 has to do with anything.

更多推荐

HCL面试问题可以任何人说出解决方案

本文发布于:2023-11-29 21:52:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647727.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   HCL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!