Problem 2631. Flip the vector from right to left
Solution Stats
Problem Comments
-
14 Comments
Try out this problem
Try Out this cody questions...
How can we do for last test case.
Can any one help me out?
how to solve below test case
%%
code = fileread('flip_vector.m');
assert(isempty(strfind(code, 'fliplr')));
Nice tricky problem
y=x(end:-1:1) I think this might help
You cannot pass the last test suite if you use the function fliplr
flipud(x')'
... didn't say anything about allowing flipud!
pretty simple
code = fileread('flip_vector.m');
assert(isempty(strfind(code, 'fliplr')));
Assertion failed.
Can anyone give me idea what is 'flip_vector.m' here?
@Ankit Meena,
'flip_vector.m' is the function file for the solution code submitted.
"code = fileread('flip_vector.m'); " -> This line of code is used to obtain the contents of your solution as a text file. And the next line of code checks for any requirement.
You can check that the first line in your solution will be -
function output = flip_vector(input)
(output and input being placeholders)
I hope this answers your question.
Nice problem
Nice problem!
Not using Matlab dedicated function to this should be written in the problem statements. I dislike this kind of "twist". Nonsense.
@Nicolas, It IS written in the problem statement -
"Request not to use direct function."
Solution Comments
-
1 Comment
pls make documentation easier
-
1 Comment
??
-
1 Comment
Fairly straightforward even if you don't use flip or flip variants
-
1 Comment
Above average
-
1 Comment
medium-low difficulty
-
1 Comment
easy
-
1 Comment
This was intuitive for me.
-
2 Comments
tricky
good problem
-
1 Comment
A good problem!
-
1 Comment
good problem
-
1 Comment
awesome
-
1 Comment
?
-
2 Comments
y=flip(x);
for i = 1:length(y)
z(i) = y((length(y)-i+1));
end;
-
1 Comment
Fail
code = fileread('flip_vector.m');
assert(isempty(strfind(code, 'fliplr')));
Assertion failed.
Can anyone suggest what is 'flip_vector.m' here?
-
1 Comment
That looks like cheating without even an ironic comment saying it is a cheat...
-
1 Comment
I don't know why this is flagged.
Problem Recent Solvers6589
Suggested Problems
-
1691 Solvers
-
3649 Solvers
-
1866 Solvers
-
1602 Solvers
-
386 Solvers
More from this Author70
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!